UNPKG

convex-pixel

Version:

The library for creating pseudo 3d interactive scenes based on webgl

17 lines 473 B
import { BehaviorSubject } from "rxjs"; import { map, distinctUntilChanged } from "rxjs/operators"; export class Store extends BehaviorSubject { constructor(initialState) { super(initialState); } dispatch(fn) { this.next(fn(this.getValue())); } select(fn) { return this.pipe(map(fn), distinctUntilChanged()); } selectSync(fn) { return fn(this.getValue()); } } //# sourceMappingURL=store.js.map