ngx-bootstrap-mini-ngrx.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. import { __extends } from 'tslib';
  2. import { queueScheduler, BehaviorSubject, Observable } from 'rxjs';
  3. import { observeOn, scan, map, distinctUntilChanged } from 'rxjs/operators';
  4. /**
  5. * @fileoverview added by tsickle
  6. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7. */
  8. /**
  9. * @template T
  10. */
  11. var /**
  12. * @template T
  13. */
  14. MiniState = /** @class */ (function (_super) {
  15. __extends(MiniState, _super);
  16. function MiniState(_initialState, actionsDispatcher$, reducer) {
  17. var _this = _super.call(this, _initialState) || this;
  18. /** @type {?} */
  19. var actionInQueue$ = actionsDispatcher$.pipe(observeOn(queueScheduler));
  20. /** @type {?} */
  21. var state$ = actionInQueue$.pipe(scan((/**
  22. * @param {?} state
  23. * @param {?} action
  24. * @return {?}
  25. */
  26. function (state, action) {
  27. if (!action) {
  28. return state;
  29. }
  30. return reducer(state, action);
  31. }), _initialState));
  32. state$.subscribe((/**
  33. * @param {?} value
  34. * @return {?}
  35. */
  36. function (value) { return _this.next(value); }));
  37. return _this;
  38. }
  39. return MiniState;
  40. }(BehaviorSubject));
  41. /**
  42. * @fileoverview added by tsickle
  43. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  44. */
  45. /**
  46. * @template T
  47. */
  48. var /**
  49. * @template T
  50. */
  51. MiniStore = /** @class */ (function (_super) {
  52. __extends(MiniStore, _super);
  53. function MiniStore(_dispatcher, _reducer,
  54. /* tslint:disable-next-line: no-any */
  55. state$) {
  56. var _this = _super.call(this) || this;
  57. _this._dispatcher = _dispatcher;
  58. _this._reducer = _reducer;
  59. /* tslint:disable-next-line: deprecation */
  60. _this.source = state$;
  61. return _this;
  62. }
  63. /**
  64. * @template R
  65. * @param {?} pathOrMapFn
  66. * @return {?}
  67. */
  68. MiniStore.prototype.select = /**
  69. * @template R
  70. * @param {?} pathOrMapFn
  71. * @return {?}
  72. */
  73. function (pathOrMapFn) {
  74. /* tslint:disable-next-line: deprecation */
  75. /** @type {?} */
  76. var mapped$ = this.source.pipe(map(pathOrMapFn));
  77. return mapped$.pipe(distinctUntilChanged());
  78. };
  79. /**
  80. * @template R
  81. * @param {?} operator
  82. * @return {?}
  83. */
  84. MiniStore.prototype.lift = /**
  85. * @template R
  86. * @param {?} operator
  87. * @return {?}
  88. */
  89. function (operator) {
  90. /** @type {?} */
  91. var store = new MiniStore(this._dispatcher, this._reducer, this);
  92. /* tslint:disable-next-line: deprecation */
  93. store.operator = operator;
  94. return store;
  95. };
  96. /**
  97. * @param {?} action
  98. * @return {?}
  99. */
  100. MiniStore.prototype.dispatch = /**
  101. * @param {?} action
  102. * @return {?}
  103. */
  104. function (action) {
  105. this._dispatcher.next(action);
  106. };
  107. /**
  108. * @param {?} action
  109. * @return {?}
  110. */
  111. MiniStore.prototype.next = /**
  112. * @param {?} action
  113. * @return {?}
  114. */
  115. function (action) {
  116. this._dispatcher.next(action);
  117. };
  118. /* tslint:disable-next-line: no-any */
  119. /* tslint:disable-next-line: no-any */
  120. /**
  121. * @param {?} err
  122. * @return {?}
  123. */
  124. MiniStore.prototype.error = /* tslint:disable-next-line: no-any */
  125. /**
  126. * @param {?} err
  127. * @return {?}
  128. */
  129. function (err) {
  130. this._dispatcher.error(err);
  131. };
  132. /**
  133. * @return {?}
  134. */
  135. MiniStore.prototype.complete = /**
  136. * @return {?}
  137. */
  138. function () {
  139. /*noop*/
  140. };
  141. return MiniStore;
  142. }(Observable));
  143. export { MiniState, MiniStore };
  144. //# sourceMappingURL=ngx-bootstrap-mini-ngrx.js.map