ngx-bootstrap
Version:
Native Angular Bootstrap Components
46 lines • 1.74 kB
JavaScript
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 { Observable } from 'rxjs';
import { distinctUntilChanged, map } from 'rxjs/operators';
var MiniStore = /** @class */ (function (_super) {
__extends(MiniStore, _super);
function MiniStore(_dispatcher, _reducer, state$) {
var _this = _super.call(this) || this;
_this._dispatcher = _dispatcher;
_this._reducer = _reducer;
_this.source = state$;
return _this;
}
MiniStore.prototype.select = function (pathOrMapFn) {
var mapped$ = this.source.pipe(map(pathOrMapFn));
return mapped$.pipe(distinctUntilChanged());
};
MiniStore.prototype.lift = function (operator) {
var store = new MiniStore(this._dispatcher, this._reducer, this);
store.operator = operator;
return store;
};
MiniStore.prototype.dispatch = function (action) {
this._dispatcher.next(action);
};
MiniStore.prototype.next = function (action) {
this._dispatcher.next(action);
};
MiniStore.prototype.error = function (err) {
this._dispatcher.error(err);
};
MiniStore.prototype.complete = function () {
/*noop*/
};
return MiniStore;
}(Observable));
export { MiniStore };
//# sourceMappingURL=store.class.js.map