UNPKG

ngx-bootstrap

Version:
30 lines 1.32 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { BehaviorSubject, queueScheduler } from 'rxjs'; import { observeOn, scan } from 'rxjs/operators'; var MiniState = /** @class */ (function (_super) { __extends(MiniState, _super); function MiniState(_initialState, actionsDispatcher$, reducer) { var _this = _super.call(this, _initialState) || this; var actionInQueue$ = actionsDispatcher$.pipe(observeOn(queueScheduler)); var state$ = actionInQueue$.pipe(scan(function (state, action) { if (!action) { return state; } return reducer(state, action); }, _initialState)); state$.subscribe(function (value) { return _this.next(value); }); return _this; } return MiniState; }(BehaviorSubject)); export { MiniState }; //# sourceMappingURL=state.class.js.map