ngx-bootstrap
Version:
Native Angular Bootstrap Components
149 lines (143 loc) • 3.87 kB
JavaScript
import { __extends } from 'tslib';
import { BehaviorSubject, queueScheduler, Observable } from 'rxjs';
import { observeOn, scan, distinctUntilChanged, map } from 'rxjs/operators';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @template T
*/
var /**
* @template T
*/
MiniState = /** @class */ (function (_super) {
__extends(MiniState, _super);
function MiniState(_initialState, actionsDispatcher$, reducer) {
var _this = _super.call(this, _initialState) || this;
/** @type {?} */
var actionInQueue$ = actionsDispatcher$.pipe(observeOn(queueScheduler));
/** @type {?} */
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));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @template T
*/
var /**
* @template T
*/
MiniStore = /** @class */ (function (_super) {
__extends(MiniStore, _super);
function MiniStore(_dispatcher, _reducer,
/* tslint:disable-next-line: no-any */
state$) {
var _this = _super.call(this) || this;
_this._dispatcher = _dispatcher;
_this._reducer = _reducer;
/* tslint:disable-next-line: deprecation */
_this.source = state$;
return _this;
}
/**
* @template R
* @param {?} pathOrMapFn
* @return {?}
*/
MiniStore.prototype.select = /**
* @template R
* @param {?} pathOrMapFn
* @return {?}
*/
function (pathOrMapFn) {
/* tslint:disable-next-line: deprecation */
/** @type {?} */
var mapped$ = this.source.pipe(map(pathOrMapFn));
return mapped$.pipe(distinctUntilChanged());
};
/**
* @template R
* @param {?} operator
* @return {?}
*/
MiniStore.prototype.lift = /**
* @template R
* @param {?} operator
* @return {?}
*/
function (operator) {
/** @type {?} */
var store = new MiniStore(this._dispatcher, this._reducer, this);
/* tslint:disable-next-line: deprecation */
store.operator = operator;
return store;
};
/**
* @param {?} action
* @return {?}
*/
MiniStore.prototype.dispatch = /**
* @param {?} action
* @return {?}
*/
function (action) {
this._dispatcher.next(action);
};
/**
* @param {?} action
* @return {?}
*/
MiniStore.prototype.next = /**
* @param {?} action
* @return {?}
*/
function (action) {
this._dispatcher.next(action);
};
/* tslint:disable-next-line: no-any */
/* tslint:disable-next-line: no-any */
/**
* @param {?} err
* @return {?}
*/
MiniStore.prototype.error = /* tslint:disable-next-line: no-any */
/**
* @param {?} err
* @return {?}
*/
function (err) {
this._dispatcher.error(err);
};
/**
* @return {?}
*/
MiniStore.prototype.complete = /**
* @return {?}
*/
function () {
/*noop*/
};
return MiniStore;
}(Observable));
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { MiniState, MiniStore };
//# sourceMappingURL=ngx-bootstrap-mini-ngrx.js.map