Closed blacktaxi closed 6 years ago
@blacktaxi that's looks great! I do see the only one downside of this approach - we need to explicitly import the corresponding operator to make it work. E.g.:
import { Atom } from '@grammarly/focal'
const counter = Atom.create(1)
counter.filter(x => x > 1)
won't work without
import 'rxjs/add/operator/filter'
Am I get it right?
@oleksiilevzhynskyi that's the idea. Alternatively you can use pipe
and import operators as standalone functions like so:
import { Atom } from '@grammarly/focal'
import 'rxjs/add/operator/pipe'
import { filter } from 'rxjs/operators/filter'
import { map } from 'rxjs/operators/map'
const counter = Atom.create(1)
counter.pipe(
filter(x => x > 1),
map(x => x + 1)
)
@oleksiilevzhynskyi also you can always import the whole of RxJS in your project, before that was done automatically by importing Focal. With this approach there is choice now.
Not importing entire RxJS anymore, only stuff that's used. Confirmed with bundle analyzer.
Before:
After: