UNPKG

4.45 kBJavaScriptView Raw
1(function (global, factory) {
2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/Subscriber'), require('rxjs/operator/pluck'), require('rxjs/operator/map'), require('rxjs/operator/distinctUntilChanged')) :
3 typeof define === 'function' && define.amd ? define(['exports', 'rxjs/Subscriber', 'rxjs/operator/pluck', 'rxjs/operator/map', 'rxjs/operator/distinctUntilChanged'], factory) :
4 (factory((global.ngrx = global.ngrx || {}, global.ngrx.core = global.ngrx.core || {}),global.Rx,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype));
5}(this, (function (exports,rxjs_Subscriber,rxjs_operator_pluck,rxjs_operator_map,rxjs_operator_distinctUntilChanged) { 'use strict';
6
7var __extends = (undefined && undefined.__extends) || function (d, b) {
8 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
9 function __() { this.constructor = d; }
10 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11};
12function enterZone(zone) {
13 return this.lift(new EnterZoneOperator(zone));
14}
15var EnterZoneOperator = (function () {
16 function EnterZoneOperator(_zone) {
17 this._zone = _zone;
18 }
19 EnterZoneOperator.prototype.call = function (subscriber, source) {
20 return source._subscribe(new EnterZoneSubscriber(subscriber, this._zone));
21 };
22 return EnterZoneOperator;
23}());
24var EnterZoneSubscriber = (function (_super) {
25 __extends(EnterZoneSubscriber, _super);
26 function EnterZoneSubscriber(destination, _zone) {
27 _super.call(this, destination);
28 this._zone = _zone;
29 }
30 EnterZoneSubscriber.prototype._next = function (value) {
31 var _this = this;
32 this._zone.run(function () { return _this.destination.next(value); });
33 };
34 return EnterZoneSubscriber;
35}(rxjs_Subscriber.Subscriber));
36
37var __extends$1 = (undefined && undefined.__extends) || function (d, b) {
38 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
39 function __() { this.constructor = d; }
40 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
41};
42function leaveZone(zone) {
43 return this.lift(new LeaveZoneOperator(zone));
44}
45var LeaveZoneOperator = (function () {
46 function LeaveZoneOperator(_zone) {
47 this._zone = _zone;
48 }
49 LeaveZoneOperator.prototype.call = function (subscriber, source) {
50 return source._subscribe(new LeaveZoneSubscriber(subscriber, this._zone));
51 };
52 return LeaveZoneOperator;
53}());
54var LeaveZoneSubscriber = (function (_super) {
55 __extends$1(LeaveZoneSubscriber, _super);
56 function LeaveZoneSubscriber(destination, _zone) {
57 _super.call(this, destination);
58 this._zone = _zone;
59 }
60 LeaveZoneSubscriber.prototype._next = function (value) {
61 var _this = this;
62 this._zone.runOutsideAngular(function () { return _this.destination.next(value); });
63 };
64 return LeaveZoneSubscriber;
65}(rxjs_Subscriber.Subscriber));
66
67function select(pathOrMapFn) {
68 var paths = [];
69 for (var _i = 1; _i < arguments.length; _i++) {
70 paths[_i - 1] = arguments[_i];
71 }
72 var mapped$;
73 if (typeof pathOrMapFn === 'string') {
74 mapped$ = rxjs_operator_pluck.pluck.call.apply(rxjs_operator_pluck.pluck, [this, pathOrMapFn].concat(paths));
75 }
76 else if (typeof pathOrMapFn === 'function') {
77 mapped$ = rxjs_operator_map.map.call(this, pathOrMapFn);
78 }
79 else {
80 throw new TypeError(("Unexpected type " + typeof pathOrMapFn + " in select operator,")
81 + " expected 'string' or 'function'");
82 }
83 return rxjs_operator_distinctUntilChanged.distinctUntilChanged.call(mapped$);
84}
85
86var compose = function () {
87 var functions = [];
88 for (var _i = 0; _i < arguments.length; _i++) {
89 functions[_i - 0] = arguments[_i];
90 }
91 return function (arg) {
92 if (functions.length === 0) {
93 return arg;
94 }
95 var last = functions[functions.length - 1];
96 var rest = functions.slice(0, -1);
97 return rest.reduceRight(function (composed, fn) { return fn(composed); }, last(arg));
98 };
99};
100
101exports.enterZone = enterZone;
102exports.EnterZoneOperator = EnterZoneOperator;
103exports.leaveZone = leaveZone;
104exports.LeaveZoneOperator = LeaveZoneOperator;
105exports.select = select;
106exports.compose = compose;
107
108Object.defineProperty(exports, '__esModule', { value: true });
109
110})));
\No newline at end of file