convex-pixel
Version:
The library for creating pseudo 3d interactive scenes based on webgl
21 lines • 716 B
JavaScript
import { __extends } from "tslib";
import { BehaviorSubject } from "rxjs";
import { map, distinctUntilChanged } from "rxjs/operators";
var Store = /** @class */ (function (_super) {
__extends(Store, _super);
function Store(initialState) {
return _super.call(this, initialState) || this;
}
Store.prototype.dispatch = function (fn) {
this.next(fn(this.getValue()));
};
Store.prototype.select = function (fn) {
return this.pipe(map(fn), distinctUntilChanged());
};
Store.prototype.selectSync = function (fn) {
return fn(this.getValue());
};
return Store;
}(BehaviorSubject));
export { Store };
//# sourceMappingURL=store.js.map