rxjs-rails 2.3.14 → 2.3.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.js +325 -370
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.all.compat.js +1115 -930
- data/vendor/assets/javascripts/rx.all.compat.min.js +4 -3
- data/vendor/assets/javascripts/rx.all.js +1113 -928
- data/vendor/assets/javascripts/rx.all.min.js +3 -3
- data/vendor/assets/javascripts/rx.async.compat.js +16 -20
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +14 -18
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.backpressure.js +26 -10
- data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
- data/vendor/assets/javascripts/rx.binding.js +2 -14
- data/vendor/assets/javascripts/rx.binding.min.js +1 -1
- data/vendor/assets/javascripts/rx.coincidence.js +13 -13
- data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +586 -378
- data/vendor/assets/javascripts/rx.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.experimental.js +37 -29
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
- data/vendor/assets/javascripts/rx.js +586 -378
- data/vendor/assets/javascripts/rx.lite.compat.js +632 -394
- data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.lite.extras.js +29 -25
- data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
- data/vendor/assets/javascripts/rx.lite.js +630 -392
- data/vendor/assets/javascripts/rx.lite.min.js +2 -2
- data/vendor/assets/javascripts/rx.min.js +2 -2
- data/vendor/assets/javascripts/rx.sorting.js +72 -0
- data/vendor/assets/javascripts/rx.sorting.min.js +3 -0
- data/vendor/assets/javascripts/rx.testing.js +116 -83
- data/vendor/assets/javascripts/rx.testing.min.js +1 -1
- data/vendor/assets/javascripts/rx.time.js +127 -101
- data/vendor/assets/javascripts/rx.time.min.js +1 -1
- metadata +4 -2
@@ -24,7 +24,7 @@
|
|
24
24
|
var Rx = {
|
25
25
|
internals: {},
|
26
26
|
config: {
|
27
|
-
Promise: root.Promise
|
27
|
+
Promise: root.Promise,
|
28
28
|
},
|
29
29
|
helpers: { }
|
30
30
|
};
|
@@ -66,6 +66,104 @@
|
|
66
66
|
var objectDisposed = 'Object has been disposed';
|
67
67
|
function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
|
68
68
|
|
69
|
+
Rx.config.longStackSupport = false;
|
70
|
+
var hasStacks = false;
|
71
|
+
try {
|
72
|
+
throw new Error();
|
73
|
+
} catch (e) {
|
74
|
+
hasStacks = !!e.stack;
|
75
|
+
}
|
76
|
+
|
77
|
+
// All code after this point will be filtered from stack traces reported by RxJS
|
78
|
+
var rStartingLine = captureLine(), rFileName;
|
79
|
+
|
80
|
+
var STACK_JUMP_SEPARATOR = "From previous event:";
|
81
|
+
|
82
|
+
function makeStackTraceLong(error, observable) {
|
83
|
+
// If possible, transform the error stack trace by removing Node and RxJS
|
84
|
+
// cruft, then concatenating with the stack trace of `observable`.
|
85
|
+
if (hasStacks &&
|
86
|
+
observable.stack &&
|
87
|
+
typeof error === "object" &&
|
88
|
+
error !== null &&
|
89
|
+
error.stack &&
|
90
|
+
error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
|
91
|
+
) {
|
92
|
+
var stacks = [];
|
93
|
+
for (var o = observable; !!o; o = o.source) {
|
94
|
+
if (o.stack) {
|
95
|
+
stacks.unshift(o.stack);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
stacks.unshift(error.stack);
|
99
|
+
|
100
|
+
var concatedStacks = stacks.join("\n" + STACK_JUMP_SEPARATOR + "\n");
|
101
|
+
error.stack = filterStackString(concatedStacks);
|
102
|
+
}
|
103
|
+
}
|
104
|
+
|
105
|
+
function filterStackString(stackString) {
|
106
|
+
var lines = stackString.split("\n"),
|
107
|
+
desiredLines = [];
|
108
|
+
for (var i = 0, len = lines.length; i < len; i++) {
|
109
|
+
var line = lines[i];
|
110
|
+
|
111
|
+
if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
|
112
|
+
desiredLines.push(line);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
return desiredLines.join("\n");
|
116
|
+
}
|
117
|
+
|
118
|
+
function isInternalFrame(stackLine) {
|
119
|
+
var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
|
120
|
+
if (!fileNameAndLineNumber) {
|
121
|
+
return false;
|
122
|
+
}
|
123
|
+
var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];
|
124
|
+
|
125
|
+
console.log(rFileName, rStartingLine, rEndingLine);
|
126
|
+
|
127
|
+
return fileName === rFileName &&
|
128
|
+
lineNumber >= rStartingLine &&
|
129
|
+
lineNumber <= rEndingLine;
|
130
|
+
}
|
131
|
+
|
132
|
+
function isNodeFrame(stackLine) {
|
133
|
+
return stackLine.indexOf("(module.js:") !== -1 ||
|
134
|
+
stackLine.indexOf("(node.js:") !== -1;
|
135
|
+
}
|
136
|
+
|
137
|
+
function captureLine() {
|
138
|
+
if (!hasStacks) { return; }
|
139
|
+
|
140
|
+
try {
|
141
|
+
throw new Error();
|
142
|
+
} catch (e) {
|
143
|
+
var lines = e.stack.split("\n");
|
144
|
+
var firstLine = lines[0].indexOf("@") > 0 ? lines[1] : lines[2];
|
145
|
+
var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
|
146
|
+
if (!fileNameAndLineNumber) { return; }
|
147
|
+
|
148
|
+
rFileName = fileNameAndLineNumber[0];
|
149
|
+
return fileNameAndLineNumber[1];
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
function getFileNameAndLineNumber(stackLine) {
|
154
|
+
// Named functions: "at functionName (filename:lineNumber:columnNumber)"
|
155
|
+
var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
|
156
|
+
if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }
|
157
|
+
|
158
|
+
// Anonymous functions: "at filename:lineNumber:columnNumber"
|
159
|
+
var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
|
160
|
+
if (attempt2) { return [attempt2[1], Number(attempt2[2])]; }
|
161
|
+
|
162
|
+
// Firefox style: "function@filename:lineNumber or @filename:lineNumber"
|
163
|
+
var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
|
164
|
+
if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }
|
165
|
+
}
|
166
|
+
|
69
167
|
// Shim in iterator support
|
70
168
|
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
|
71
169
|
'_es6shim_iterator_';
|
@@ -76,7 +174,21 @@
|
|
76
174
|
|
77
175
|
var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined };
|
78
176
|
|
79
|
-
Rx.
|
177
|
+
var isIterable = Rx.helpers.isIterable = function (o) {
|
178
|
+
return o[$iterator$] !== undefined;
|
179
|
+
}
|
180
|
+
|
181
|
+
var isArrayLike = Rx.helpers.isArrayLike = function (o) {
|
182
|
+
return o && o.length !== undefined;
|
183
|
+
}
|
184
|
+
|
185
|
+
Rx.helpers.iterator = $iterator$;
|
186
|
+
|
187
|
+
var deprecate = Rx.helpers.deprecate = function (name, alternative) {
|
188
|
+
/*if (typeof console !== "undefined" && typeof console.warn === "function") {
|
189
|
+
console.warn(name + ' is deprecated, use ' + alternative + ' instead.', new Error('').stack);
|
190
|
+
}*/
|
191
|
+
}
|
80
192
|
|
81
193
|
/** `Object#toString` result shortcuts */
|
82
194
|
var argsClass = '[object Arguments]',
|
@@ -93,15 +205,16 @@
|
|
93
205
|
var toString = Object.prototype.toString,
|
94
206
|
hasOwnProperty = Object.prototype.hasOwnProperty,
|
95
207
|
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
|
96
|
-
|
208
|
+
supportNodeClass,
|
97
209
|
errorProto = Error.prototype,
|
98
210
|
objectProto = Object.prototype,
|
211
|
+
stringProto = String.prototype,
|
99
212
|
propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
100
213
|
|
101
214
|
try {
|
102
|
-
|
103
|
-
} catch(e) {
|
104
|
-
|
215
|
+
supportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
|
216
|
+
} catch (e) {
|
217
|
+
supportNodeClass = true;
|
105
218
|
}
|
106
219
|
|
107
220
|
var shadowedProps = [
|
@@ -206,7 +319,7 @@
|
|
206
319
|
return typeof value.toString != 'function' && typeof (value + '') == 'string';
|
207
320
|
}
|
208
321
|
|
209
|
-
|
322
|
+
var isArguments = function(value) {
|
210
323
|
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
|
211
324
|
}
|
212
325
|
|
@@ -262,10 +375,10 @@
|
|
262
375
|
|
263
376
|
case numberClass:
|
264
377
|
// treat `NaN` vs. `NaN` as equal
|
265
|
-
return (a != +a)
|
266
|
-
|
378
|
+
return (a != +a) ?
|
379
|
+
b != +b :
|
267
380
|
// but treat `-0` vs. `+0` as not equal
|
268
|
-
|
381
|
+
(a == 0 ? (1 / a == 1 / b) : a == +b);
|
269
382
|
|
270
383
|
case regexpClass:
|
271
384
|
case stringClass:
|
@@ -1175,15 +1288,13 @@ if (!Array.prototype.forEach) {
|
|
1175
1288
|
return SchedulePeriodicRecursive;
|
1176
1289
|
}());
|
1177
1290
|
|
1178
|
-
/**
|
1179
|
-
* Gets a scheduler that schedules work immediately on the current thread.
|
1180
|
-
*/
|
1291
|
+
/** Gets a scheduler that schedules work immediately on the current thread. */
|
1181
1292
|
var immediateScheduler = Scheduler.immediate = (function () {
|
1182
1293
|
|
1183
1294
|
function scheduleNow(state, action) { return action(this, state); }
|
1184
1295
|
|
1185
1296
|
function scheduleRelative(state, dueTime, action) {
|
1186
|
-
var dt = normalizeTime(
|
1297
|
+
var dt = normalizeTime(dueTime);
|
1187
1298
|
while (dt - this.now() > 0) { }
|
1188
1299
|
return action(this, state);
|
1189
1300
|
}
|
@@ -1297,24 +1408,24 @@ if (!Array.prototype.forEach) {
|
|
1297
1408
|
oldHandler = root.onmessage;
|
1298
1409
|
// Test for async
|
1299
1410
|
root.onmessage = function () { isAsync = true; };
|
1300
|
-
root.postMessage('','*');
|
1411
|
+
root.postMessage('', '*');
|
1301
1412
|
root.onmessage = oldHandler;
|
1302
1413
|
|
1303
1414
|
return isAsync;
|
1304
1415
|
}
|
1305
1416
|
|
1306
|
-
// Use in order,
|
1307
|
-
if (typeof
|
1308
|
-
scheduleMethod = process.nextTick;
|
1309
|
-
} else if (typeof setImmediate === 'function') {
|
1417
|
+
// Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
|
1418
|
+
if (typeof setImmediate === 'function') {
|
1310
1419
|
scheduleMethod = setImmediate;
|
1311
1420
|
clearMethod = clearImmediate;
|
1421
|
+
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
|
1422
|
+
scheduleMethod = process.nextTick;
|
1312
1423
|
} else if (postMessageSupported()) {
|
1313
1424
|
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
|
1314
1425
|
tasks = {},
|
1315
1426
|
taskId = 0;
|
1316
1427
|
|
1317
|
-
function
|
1428
|
+
var onGlobalPostMessage = function (event) {
|
1318
1429
|
// Only if we're a match to avoid any other global events
|
1319
1430
|
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
|
1320
1431
|
var handleId = event.data.substring(MSG_PREFIX.length),
|
@@ -1615,8 +1726,8 @@ if (!Array.prototype.forEach) {
|
|
1615
1726
|
var e;
|
1616
1727
|
try {
|
1617
1728
|
e = sources[$iterator$]();
|
1618
|
-
} catch(err) {
|
1619
|
-
observer.onError();
|
1729
|
+
} catch (err) {
|
1730
|
+
observer.onError(err);
|
1620
1731
|
return;
|
1621
1732
|
}
|
1622
1733
|
|
@@ -1657,14 +1768,14 @@ if (!Array.prototype.forEach) {
|
|
1657
1768
|
});
|
1658
1769
|
};
|
1659
1770
|
|
1660
|
-
Enumerable.prototype.
|
1771
|
+
Enumerable.prototype.catchError = function () {
|
1661
1772
|
var sources = this;
|
1662
1773
|
return new AnonymousObservable(function (observer) {
|
1663
1774
|
var e;
|
1664
1775
|
try {
|
1665
1776
|
e = sources[$iterator$]();
|
1666
|
-
} catch(err) {
|
1667
|
-
observer.onError();
|
1777
|
+
} catch (err) {
|
1778
|
+
observer.onError(err);
|
1668
1779
|
return;
|
1669
1780
|
}
|
1670
1781
|
|
@@ -1802,7 +1913,7 @@ if (!Array.prototype.forEach) {
|
|
1802
1913
|
* @param {Scheduler} scheduler Scheduler to schedule observer messages on.
|
1803
1914
|
* @returns {Observer} Observer whose messages are scheduled on the given scheduler.
|
1804
1915
|
*/
|
1805
|
-
Observer.notifyOn = function (scheduler) {
|
1916
|
+
Observer.prototype.notifyOn = function (scheduler) {
|
1806
1917
|
return new ObserveOnObserver(scheduler, this);
|
1807
1918
|
};
|
1808
1919
|
|
@@ -1983,23 +2094,17 @@ if (!Array.prototype.forEach) {
|
|
1983
2094
|
|
1984
2095
|
ScheduledObserver.prototype.next = function (value) {
|
1985
2096
|
var self = this;
|
1986
|
-
this.queue.push(function () {
|
1987
|
-
self.observer.onNext(value);
|
1988
|
-
});
|
2097
|
+
this.queue.push(function () { self.observer.onNext(value); });
|
1989
2098
|
};
|
1990
2099
|
|
1991
|
-
ScheduledObserver.prototype.error = function (
|
2100
|
+
ScheduledObserver.prototype.error = function (e) {
|
1992
2101
|
var self = this;
|
1993
|
-
this.queue.push(function () {
|
1994
|
-
self.observer.onError(err);
|
1995
|
-
});
|
2102
|
+
this.queue.push(function () { self.observer.onError(e); });
|
1996
2103
|
};
|
1997
2104
|
|
1998
2105
|
ScheduledObserver.prototype.completed = function () {
|
1999
2106
|
var self = this;
|
2000
|
-
this.queue.push(function () {
|
2001
|
-
self.observer.onCompleted();
|
2002
|
-
});
|
2107
|
+
this.queue.push(function () { self.observer.onCompleted(); });
|
2003
2108
|
};
|
2004
2109
|
|
2005
2110
|
ScheduledObserver.prototype.ensureActive = function () {
|
@@ -2040,8 +2145,9 @@ if (!Array.prototype.forEach) {
|
|
2040
2145
|
var ObserveOnObserver = (function (__super__) {
|
2041
2146
|
inherits(ObserveOnObserver, __super__);
|
2042
2147
|
|
2043
|
-
function ObserveOnObserver() {
|
2044
|
-
__super__.
|
2148
|
+
function ObserveOnObserver(scheduler, observer, cancel) {
|
2149
|
+
__super__.call(this, scheduler, observer);
|
2150
|
+
this._cancel = cancel;
|
2045
2151
|
}
|
2046
2152
|
|
2047
2153
|
ObserveOnObserver.prototype.next = function (value) {
|
@@ -2059,6 +2165,12 @@ if (!Array.prototype.forEach) {
|
|
2059
2165
|
this.ensureActive();
|
2060
2166
|
};
|
2061
2167
|
|
2168
|
+
ObserveOnObserver.prototype.dispose = function () {
|
2169
|
+
__super__.prototype.dispose.call(this);
|
2170
|
+
this._cancel && this._cancel.dispose();
|
2171
|
+
this._cancel = null;
|
2172
|
+
};
|
2173
|
+
|
2062
2174
|
return ObserveOnObserver;
|
2063
2175
|
})(ScheduledObserver);
|
2064
2176
|
|
@@ -2070,6 +2182,24 @@ if (!Array.prototype.forEach) {
|
|
2070
2182
|
var Observable = Rx.Observable = (function () {
|
2071
2183
|
|
2072
2184
|
function Observable(subscribe) {
|
2185
|
+
if (Rx.config.longStackSupport && hasStacks) {
|
2186
|
+
try {
|
2187
|
+
throw new Error();
|
2188
|
+
} catch (e) {
|
2189
|
+
this.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
|
2190
|
+
}
|
2191
|
+
|
2192
|
+
var self = this;
|
2193
|
+
this._subscribe = function (observer) {
|
2194
|
+
observer.onError = function (err) {
|
2195
|
+
makeStackTraceLong(self, err);
|
2196
|
+
observer.onError(err);
|
2197
|
+
};
|
2198
|
+
|
2199
|
+
subscribe(observer);
|
2200
|
+
};
|
2201
|
+
}
|
2202
|
+
|
2073
2203
|
this._subscribe = subscribe;
|
2074
2204
|
}
|
2075
2205
|
|
@@ -2134,7 +2264,7 @@ if (!Array.prototype.forEach) {
|
|
2134
2264
|
var source = this;
|
2135
2265
|
return new AnonymousObservable(function (observer) {
|
2136
2266
|
return source.subscribe(new ObserveOnObserver(scheduler, observer));
|
2137
|
-
});
|
2267
|
+
}, source);
|
2138
2268
|
};
|
2139
2269
|
|
2140
2270
|
/**
|
@@ -2156,7 +2286,7 @@ if (!Array.prototype.forEach) {
|
|
2156
2286
|
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
|
2157
2287
|
}));
|
2158
2288
|
return d;
|
2159
|
-
});
|
2289
|
+
}, source);
|
2160
2290
|
};
|
2161
2291
|
|
2162
2292
|
/**
|
@@ -2170,10 +2300,8 @@ if (!Array.prototype.forEach) {
|
|
2170
2300
|
|
2171
2301
|
promise.then(
|
2172
2302
|
function (value) {
|
2173
|
-
|
2174
|
-
|
2175
|
-
subject.onCompleted();
|
2176
|
-
}
|
2303
|
+
subject.onNext(value);
|
2304
|
+
subject.onCompleted();
|
2177
2305
|
},
|
2178
2306
|
subject.onError.bind(subject));
|
2179
2307
|
|
@@ -2209,36 +2337,34 @@ if (!Array.prototype.forEach) {
|
|
2209
2337
|
};
|
2210
2338
|
|
2211
2339
|
/**
|
2212
|
-
* Creates
|
2213
|
-
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
|
2340
|
+
* Creates an array from an observable sequence.
|
2341
|
+
* @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.
|
2214
2342
|
*/
|
2215
2343
|
observableProto.toArray = function () {
|
2216
|
-
var
|
2344
|
+
var source = this;
|
2217
2345
|
return new AnonymousObservable(function(observer) {
|
2218
2346
|
var arr = [];
|
2219
|
-
return
|
2347
|
+
return source.subscribe(
|
2220
2348
|
arr.push.bind(arr),
|
2221
2349
|
observer.onError.bind(observer),
|
2222
2350
|
function () {
|
2223
2351
|
observer.onNext(arr);
|
2224
2352
|
observer.onCompleted();
|
2225
2353
|
});
|
2226
|
-
});
|
2354
|
+
}, source);
|
2227
2355
|
};
|
2228
2356
|
|
2229
2357
|
/**
|
2230
2358
|
* Creates an observable sequence from a specified subscribe method implementation.
|
2231
|
-
*
|
2232
2359
|
* @example
|
2233
2360
|
* var res = Rx.Observable.create(function (observer) { return function () { } );
|
2234
2361
|
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
|
2235
2362
|
* var res = Rx.Observable.create(function (observer) { } );
|
2236
|
-
*
|
2237
2363
|
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
|
2238
2364
|
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
|
2239
2365
|
*/
|
2240
|
-
Observable.create = Observable.createWithDisposable = function (subscribe) {
|
2241
|
-
return new AnonymousObservable(subscribe);
|
2366
|
+
Observable.create = Observable.createWithDisposable = function (subscribe, parent) {
|
2367
|
+
return new AnonymousObservable(subscribe, parent);
|
2242
2368
|
};
|
2243
2369
|
|
2244
2370
|
/**
|
@@ -2282,6 +2408,60 @@ if (!Array.prototype.forEach) {
|
|
2282
2408
|
|
2283
2409
|
var maxSafeInteger = Math.pow(2, 53) - 1;
|
2284
2410
|
|
2411
|
+
function StringIterable(str) {
|
2412
|
+
this._s = s;
|
2413
|
+
}
|
2414
|
+
|
2415
|
+
StringIterable.prototype[$iterator$] = function () {
|
2416
|
+
return new StringIterator(this._s);
|
2417
|
+
};
|
2418
|
+
|
2419
|
+
function StringIterator(str) {
|
2420
|
+
this._s = s;
|
2421
|
+
this._l = s.length;
|
2422
|
+
this._i = 0;
|
2423
|
+
}
|
2424
|
+
|
2425
|
+
StringIterator.prototype[$iterator$] = function () {
|
2426
|
+
return this;
|
2427
|
+
};
|
2428
|
+
|
2429
|
+
StringIterator.prototype.next = function () {
|
2430
|
+
if (this._i < this._l) {
|
2431
|
+
var val = this._s.charAt(this._i++);
|
2432
|
+
return { done: false, value: val };
|
2433
|
+
} else {
|
2434
|
+
return doneEnumerator;
|
2435
|
+
}
|
2436
|
+
};
|
2437
|
+
|
2438
|
+
function ArrayIterable(a) {
|
2439
|
+
this._a = a;
|
2440
|
+
}
|
2441
|
+
|
2442
|
+
ArrayIterable.prototype[$iterator$] = function () {
|
2443
|
+
return new ArrayIterator(this._a);
|
2444
|
+
};
|
2445
|
+
|
2446
|
+
function ArrayIterator(a) {
|
2447
|
+
this._a = a;
|
2448
|
+
this._l = toLength(a);
|
2449
|
+
this._i = 0;
|
2450
|
+
}
|
2451
|
+
|
2452
|
+
ArrayIterator.prototype[$iterator$] = function () {
|
2453
|
+
return this;
|
2454
|
+
};
|
2455
|
+
|
2456
|
+
ArrayIterator.prototype.next = function () {
|
2457
|
+
if (this._i < this._l) {
|
2458
|
+
var val = this._a[this._i++];
|
2459
|
+
return { done: false, value: val };
|
2460
|
+
} else {
|
2461
|
+
return doneEnumerator;
|
2462
|
+
}
|
2463
|
+
};
|
2464
|
+
|
2285
2465
|
function numberIsFinite(value) {
|
2286
2466
|
return typeof value === 'number' && root.isFinite(value);
|
2287
2467
|
}
|
@@ -2290,8 +2470,18 @@ if (!Array.prototype.forEach) {
|
|
2290
2470
|
return n !== n;
|
2291
2471
|
}
|
2292
2472
|
|
2293
|
-
function
|
2294
|
-
|
2473
|
+
function getIterable(o) {
|
2474
|
+
var i = o[$iterator$], it;
|
2475
|
+
if (!i && typeof o === 'string') {
|
2476
|
+
it = new StringIterable(o);
|
2477
|
+
return it[$iterator$]();
|
2478
|
+
}
|
2479
|
+
if (!i && o.length !== undefined) {
|
2480
|
+
it = new ArrayIterable(o);
|
2481
|
+
return it[$iterator$]();
|
2482
|
+
}
|
2483
|
+
if (!i) { throw new TypeError('Object is not iterable'); }
|
2484
|
+
return o[$iterator$]();
|
2295
2485
|
}
|
2296
2486
|
|
2297
2487
|
function sign(value) {
|
@@ -2311,10 +2501,6 @@ if (!Array.prototype.forEach) {
|
|
2311
2501
|
return len;
|
2312
2502
|
}
|
2313
2503
|
|
2314
|
-
function isCallable(f) {
|
2315
|
-
return Object.prototype.toString.call(f) === '[object Function]' && typeof f === 'function';
|
2316
|
-
}
|
2317
|
-
|
2318
2504
|
/**
|
2319
2505
|
* This method creates a new Observable sequence from an array-like or iterable object.
|
2320
2506
|
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
|
@@ -2326,66 +2512,52 @@ if (!Array.prototype.forEach) {
|
|
2326
2512
|
if (iterable == null) {
|
2327
2513
|
throw new Error('iterable cannot be null.')
|
2328
2514
|
}
|
2329
|
-
if (mapFn && !
|
2515
|
+
if (mapFn && !isFunction(mapFn)) {
|
2330
2516
|
throw new Error('mapFn when provided must be a function');
|
2331
2517
|
}
|
2332
2518
|
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
|
2519
|
+
var list = Object(iterable), it = getIterable(list);
|
2333
2520
|
return new AnonymousObservable(function (observer) {
|
2334
|
-
var
|
2335
|
-
objIsIterable = isIterable(list),
|
2336
|
-
len = objIsIterable ? 0 : toLength(list),
|
2337
|
-
it = objIsIterable ? list[$iterator$]() : null,
|
2338
|
-
i = 0;
|
2521
|
+
var i = 0;
|
2339
2522
|
return scheduler.scheduleRecursive(function (self) {
|
2340
|
-
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
observer.onCompleted();
|
2352
|
-
return;
|
2353
|
-
}
|
2523
|
+
var next;
|
2524
|
+
try {
|
2525
|
+
next = it.next();
|
2526
|
+
} catch (e) {
|
2527
|
+
observer.onError(e);
|
2528
|
+
return;
|
2529
|
+
}
|
2530
|
+
if (next.done) {
|
2531
|
+
observer.onCompleted();
|
2532
|
+
return;
|
2533
|
+
}
|
2354
2534
|
|
2355
|
-
|
2356
|
-
} else {
|
2357
|
-
result = !!list.charAt ? list.charAt(i) : list[i];
|
2358
|
-
}
|
2535
|
+
var result = next.value;
|
2359
2536
|
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2363
|
-
|
2364
|
-
|
2365
|
-
|
2366
|
-
}
|
2537
|
+
if (mapFn && isFunction(mapFn)) {
|
2538
|
+
try {
|
2539
|
+
result = mapFn.call(thisArg, result, i);
|
2540
|
+
} catch (e) {
|
2541
|
+
observer.onError(e);
|
2542
|
+
return;
|
2367
2543
|
}
|
2368
|
-
|
2369
|
-
observer.onNext(result);
|
2370
|
-
i++;
|
2371
|
-
self();
|
2372
|
-
} else {
|
2373
|
-
observer.onCompleted();
|
2374
2544
|
}
|
2545
|
+
|
2546
|
+
observer.onNext(result);
|
2547
|
+
i++;
|
2548
|
+
self();
|
2375
2549
|
});
|
2376
2550
|
});
|
2377
2551
|
};
|
2378
2552
|
|
2379
2553
|
/**
|
2380
2554
|
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
|
2381
|
-
*
|
2382
|
-
* @example
|
2383
|
-
* var res = Rx.Observable.fromArray([1,2,3]);
|
2384
|
-
* var res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
|
2555
|
+
* @deprecated use Observable.from or Observable.of
|
2385
2556
|
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
|
2386
2557
|
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
|
2387
2558
|
*/
|
2388
2559
|
var observableFromArray = Observable.fromArray = function (array, scheduler) {
|
2560
|
+
deprecate('fromArray', 'from');
|
2389
2561
|
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
|
2390
2562
|
return new AnonymousObservable(function (observer) {
|
2391
2563
|
var count = 0, len = array.length;
|
@@ -2453,29 +2625,36 @@ if (!Array.prototype.forEach) {
|
|
2453
2625
|
});
|
2454
2626
|
};
|
2455
2627
|
|
2628
|
+
function observableOf (scheduler, array) {
|
2629
|
+
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
|
2630
|
+
return new AnonymousObservable(function (observer) {
|
2631
|
+
var count = 0, len = array.length;
|
2632
|
+
return scheduler.scheduleRecursive(function (self) {
|
2633
|
+
if (count < len) {
|
2634
|
+
observer.onNext(array[count++]);
|
2635
|
+
self();
|
2636
|
+
} else {
|
2637
|
+
observer.onCompleted();
|
2638
|
+
}
|
2639
|
+
});
|
2640
|
+
});
|
2641
|
+
}
|
2642
|
+
|
2456
2643
|
/**
|
2457
2644
|
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
|
2458
|
-
* @example
|
2459
|
-
* var res = Rx.Observable.of(1,2,3);
|
2460
2645
|
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
|
2461
2646
|
*/
|
2462
2647
|
Observable.of = function () {
|
2463
|
-
|
2464
|
-
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
2465
|
-
return observableFromArray(args);
|
2648
|
+
return observableOf(null, arguments);
|
2466
2649
|
};
|
2467
2650
|
|
2468
2651
|
/**
|
2469
2652
|
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
|
2470
|
-
* @example
|
2471
|
-
* var res = Rx.Observable.of(1,2,3);
|
2472
2653
|
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
|
2473
2654
|
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
|
2474
2655
|
*/
|
2475
|
-
|
2476
|
-
|
2477
|
-
for(var i = 0; i < len; i++) { args[i] = arguments[i + 1]; }
|
2478
|
-
return observableFromArray(args, scheduler);
|
2656
|
+
Observable.ofWithScheduler = function (scheduler) {
|
2657
|
+
return observableOf(scheduler, slice.call(arguments, 1));
|
2479
2658
|
};
|
2480
2659
|
|
2481
2660
|
/**
|
@@ -2532,7 +2711,7 @@ if (!Array.prototype.forEach) {
|
|
2532
2711
|
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
|
2533
2712
|
* @returns {Observable} An observable sequence containing the single specified element.
|
2534
2713
|
*/
|
2535
|
-
var observableReturn = Observable['return'] = Observable.
|
2714
|
+
var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {
|
2536
2715
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
2537
2716
|
return new AnonymousObservable(function (observer) {
|
2538
2717
|
return scheduler.schedule(function () {
|
@@ -2542,6 +2721,12 @@ if (!Array.prototype.forEach) {
|
|
2542
2721
|
});
|
2543
2722
|
};
|
2544
2723
|
|
2724
|
+
/** @deprecated use return or just */
|
2725
|
+
Observable.returnValue = function () {
|
2726
|
+
deprecate('returnValue', 'return or just');
|
2727
|
+
return observableReturn.apply(null, arguments);
|
2728
|
+
};
|
2729
|
+
|
2545
2730
|
/**
|
2546
2731
|
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
|
2547
2732
|
* There is an alias to this method called 'throwError' for browsers <IE9.
|
@@ -2684,7 +2869,7 @@ if (!Array.prototype.forEach) {
|
|
2684
2869
|
}, observer.onCompleted.bind(observer)));
|
2685
2870
|
|
2686
2871
|
return subscription;
|
2687
|
-
});
|
2872
|
+
}, source);
|
2688
2873
|
}
|
2689
2874
|
|
2690
2875
|
/**
|
@@ -2695,19 +2880,35 @@ if (!Array.prototype.forEach) {
|
|
2695
2880
|
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
|
2696
2881
|
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
|
2697
2882
|
*/
|
2698
|
-
observableProto['catch'] = observableProto.catchError =
|
2883
|
+
observableProto['catch'] = observableProto.catchError = function (handlerOrSecond) {
|
2699
2884
|
return typeof handlerOrSecond === 'function' ?
|
2700
2885
|
observableCatchHandler(this, handlerOrSecond) :
|
2701
2886
|
observableCatch([this, handlerOrSecond]);
|
2702
2887
|
};
|
2703
2888
|
|
2889
|
+
/**
|
2890
|
+
* @deprecated use #catch or #catchError instead.
|
2891
|
+
*/
|
2892
|
+
observableProto.catchException = function (handlerOrSecond) {
|
2893
|
+
deprecate('catchException', 'catch or catchError');
|
2894
|
+
return this.catchError(handlerOrSecond);
|
2895
|
+
};
|
2896
|
+
|
2704
2897
|
/**
|
2705
2898
|
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
|
2706
2899
|
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
|
2707
2900
|
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
|
2708
2901
|
*/
|
2709
|
-
var observableCatch = Observable.
|
2710
|
-
return enumerableOf(argsOrArray(arguments, 0)).
|
2902
|
+
var observableCatch = Observable.catchError = Observable['catch'] = function () {
|
2903
|
+
return enumerableOf(argsOrArray(arguments, 0)).catchError();
|
2904
|
+
};
|
2905
|
+
|
2906
|
+
/**
|
2907
|
+
* @deprecated use #catch or #catchError instead.
|
2908
|
+
*/
|
2909
|
+
Observable.catchException = function () {
|
2910
|
+
deprecate('catchException', 'catch or catchError');
|
2911
|
+
return observableCatch.apply(null, arguments);
|
2711
2912
|
};
|
2712
2913
|
|
2713
2914
|
/**
|
@@ -2791,7 +2992,7 @@ if (!Array.prototype.forEach) {
|
|
2791
2992
|
}
|
2792
2993
|
|
2793
2994
|
return new CompositeDisposable(subscriptions);
|
2794
|
-
});
|
2995
|
+
}, this);
|
2795
2996
|
};
|
2796
2997
|
|
2797
2998
|
/**
|
@@ -2817,13 +3018,19 @@ if (!Array.prototype.forEach) {
|
|
2817
3018
|
return enumerableOf(argsOrArray(arguments, 0)).concat();
|
2818
3019
|
};
|
2819
3020
|
|
2820
|
-
|
2821
|
-
|
2822
|
-
|
2823
|
-
|
2824
|
-
|
2825
|
-
|
2826
|
-
|
3021
|
+
/**
|
3022
|
+
* Concatenates an observable sequence of observable sequences.
|
3023
|
+
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
|
3024
|
+
*/
|
3025
|
+
observableProto.concatAll = function () {
|
3026
|
+
return this.merge(1);
|
3027
|
+
};
|
3028
|
+
|
3029
|
+
/** @deprecated Use `concatAll` instead. */
|
3030
|
+
observableProto.concatObservable = function () {
|
3031
|
+
deprecate('concatObservable', 'concatAll');
|
3032
|
+
return this.merge(1);
|
3033
|
+
};
|
2827
3034
|
|
2828
3035
|
/**
|
2829
3036
|
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
|
@@ -2870,43 +3077,37 @@ if (!Array.prototype.forEach) {
|
|
2870
3077
|
activeCount === 0 && observer.onCompleted();
|
2871
3078
|
}));
|
2872
3079
|
return group;
|
2873
|
-
});
|
3080
|
+
}, sources);
|
2874
3081
|
};
|
2875
3082
|
|
2876
|
-
|
2877
|
-
|
2878
|
-
|
2879
|
-
|
2880
|
-
|
2881
|
-
|
2882
|
-
|
2883
|
-
|
2884
|
-
|
2885
|
-
|
2886
|
-
|
2887
|
-
|
2888
|
-
|
2889
|
-
|
2890
|
-
|
2891
|
-
|
2892
|
-
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
}
|
2899
|
-
if (Array.isArray(sources[0])) {
|
2900
|
-
sources = sources[0];
|
2901
|
-
}
|
2902
|
-
return observableFromArray(sources, scheduler).mergeObservable();
|
2903
|
-
};
|
3083
|
+
/**
|
3084
|
+
* Merges all the observable sequences into a single observable sequence.
|
3085
|
+
* The scheduler is optional and if not specified, the immediate scheduler is used.
|
3086
|
+
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
|
3087
|
+
*/
|
3088
|
+
var observableMerge = Observable.merge = function () {
|
3089
|
+
var scheduler, sources;
|
3090
|
+
if (!arguments[0]) {
|
3091
|
+
scheduler = immediateScheduler;
|
3092
|
+
sources = slice.call(arguments, 1);
|
3093
|
+
} else if (isScheduler(arguments[0])) {
|
3094
|
+
scheduler = arguments[0];
|
3095
|
+
sources = slice.call(arguments, 1);
|
3096
|
+
} else {
|
3097
|
+
scheduler = immediateScheduler;
|
3098
|
+
sources = slice.call(arguments, 0);
|
3099
|
+
}
|
3100
|
+
if (Array.isArray(sources[0])) {
|
3101
|
+
sources = sources[0];
|
3102
|
+
}
|
3103
|
+
return observableOf(scheduler, sources).mergeAll();
|
3104
|
+
};
|
2904
3105
|
|
2905
3106
|
/**
|
2906
3107
|
* Merges an observable sequence of observable sequences into an observable sequence.
|
2907
3108
|
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
|
2908
3109
|
*/
|
2909
|
-
observableProto.
|
3110
|
+
observableProto.mergeAll = function () {
|
2910
3111
|
var sources = this;
|
2911
3112
|
return new AnonymousObservable(function (observer) {
|
2912
3113
|
var group = new CompositeDisposable(),
|
@@ -2930,7 +3131,15 @@ if (!Array.prototype.forEach) {
|
|
2930
3131
|
group.length === 1 && observer.onCompleted();
|
2931
3132
|
}));
|
2932
3133
|
return group;
|
2933
|
-
});
|
3134
|
+
}, sources);
|
3135
|
+
};
|
3136
|
+
|
3137
|
+
/**
|
3138
|
+
* @deprecated use #mergeAll instead.
|
3139
|
+
*/
|
3140
|
+
observableProto.mergeObservable = function () {
|
3141
|
+
deprecate('mergeObservable', 'mergeAll');
|
3142
|
+
return this.mergeAll.apply(this, arguments);
|
2934
3143
|
};
|
2935
3144
|
|
2936
3145
|
/**
|
@@ -2998,7 +3207,7 @@ if (!Array.prototype.forEach) {
|
|
2998
3207
|
}));
|
2999
3208
|
|
3000
3209
|
return disposables;
|
3001
|
-
});
|
3210
|
+
}, source);
|
3002
3211
|
};
|
3003
3212
|
|
3004
3213
|
/**
|
@@ -3037,7 +3246,7 @@ if (!Array.prototype.forEach) {
|
|
3037
3246
|
!hasLatest && observer.onCompleted();
|
3038
3247
|
});
|
3039
3248
|
return new CompositeDisposable(subscription, innerSubscription);
|
3040
|
-
});
|
3249
|
+
}, sources);
|
3041
3250
|
};
|
3042
3251
|
|
3043
3252
|
/**
|
@@ -3053,7 +3262,7 @@ if (!Array.prototype.forEach) {
|
|
3053
3262
|
source.subscribe(observer),
|
3054
3263
|
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
|
3055
3264
|
);
|
3056
|
-
});
|
3265
|
+
}, source);
|
3057
3266
|
};
|
3058
3267
|
|
3059
3268
|
function zipArray(second, resultSelector) {
|
@@ -3074,7 +3283,7 @@ if (!Array.prototype.forEach) {
|
|
3074
3283
|
observer.onCompleted();
|
3075
3284
|
}
|
3076
3285
|
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3077
|
-
});
|
3286
|
+
}, first);
|
3078
3287
|
}
|
3079
3288
|
|
3080
3289
|
/**
|
@@ -3136,7 +3345,7 @@ if (!Array.prototype.forEach) {
|
|
3136
3345
|
}
|
3137
3346
|
|
3138
3347
|
return new CompositeDisposable(subscriptions);
|
3139
|
-
});
|
3348
|
+
}, parent);
|
3140
3349
|
};
|
3141
3350
|
|
3142
3351
|
/**
|
@@ -3206,7 +3415,7 @@ if (!Array.prototype.forEach) {
|
|
3206
3415
|
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
|
3207
3416
|
*/
|
3208
3417
|
observableProto.asObservable = function () {
|
3209
|
-
return new AnonymousObservable(this.subscribe.bind(this));
|
3418
|
+
return new AnonymousObservable(this.subscribe.bind(this), this);
|
3210
3419
|
};
|
3211
3420
|
|
3212
3421
|
/**
|
@@ -3230,60 +3439,58 @@ if (!Array.prototype.forEach) {
|
|
3230
3439
|
});
|
3231
3440
|
};
|
3232
3441
|
|
3233
|
-
|
3234
|
-
|
3235
|
-
|
3236
|
-
|
3237
|
-
|
3238
|
-
|
3239
|
-
|
3240
|
-
|
3241
|
-
|
3242
|
-
|
3243
|
-
});
|
3244
|
-
};
|
3442
|
+
/**
|
3443
|
+
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
|
3444
|
+
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
|
3445
|
+
*/
|
3446
|
+
observableProto.dematerialize = function () {
|
3447
|
+
var source = this;
|
3448
|
+
return new AnonymousObservable(function (observer) {
|
3449
|
+
return source.subscribe(function (x) { return x.accept(observer); }, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3450
|
+
}, this);
|
3451
|
+
};
|
3245
3452
|
|
3246
|
-
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3254
|
-
|
3255
|
-
|
3256
|
-
|
3257
|
-
|
3258
|
-
|
3259
|
-
|
3260
|
-
|
3261
|
-
|
3262
|
-
|
3263
|
-
|
3264
|
-
|
3265
|
-
|
3266
|
-
|
3267
|
-
|
3268
|
-
|
3269
|
-
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
|
3274
|
-
|
3275
|
-
|
3276
|
-
|
3277
|
-
|
3278
|
-
|
3279
|
-
|
3280
|
-
|
3281
|
-
|
3282
|
-
|
3283
|
-
|
3284
|
-
|
3285
|
-
|
3286
|
-
|
3453
|
+
/**
|
3454
|
+
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
|
3455
|
+
*
|
3456
|
+
* var obs = observable.distinctUntilChanged();
|
3457
|
+
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
|
3458
|
+
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
|
3459
|
+
*
|
3460
|
+
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
|
3461
|
+
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
|
3462
|
+
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
|
3463
|
+
*/
|
3464
|
+
observableProto.distinctUntilChanged = function (keySelector, comparer) {
|
3465
|
+
var source = this;
|
3466
|
+
keySelector || (keySelector = identity);
|
3467
|
+
comparer || (comparer = defaultComparer);
|
3468
|
+
return new AnonymousObservable(function (observer) {
|
3469
|
+
var hasCurrentKey = false, currentKey;
|
3470
|
+
return source.subscribe(function (value) {
|
3471
|
+
var comparerEquals = false, key;
|
3472
|
+
try {
|
3473
|
+
key = keySelector(value);
|
3474
|
+
} catch (e) {
|
3475
|
+
observer.onError(e);
|
3476
|
+
return;
|
3477
|
+
}
|
3478
|
+
if (hasCurrentKey) {
|
3479
|
+
try {
|
3480
|
+
comparerEquals = comparer(currentKey, key);
|
3481
|
+
} catch (e) {
|
3482
|
+
observer.onError(e);
|
3483
|
+
return;
|
3484
|
+
}
|
3485
|
+
}
|
3486
|
+
if (!hasCurrentKey || !comparerEquals) {
|
3487
|
+
hasCurrentKey = true;
|
3488
|
+
currentKey = key;
|
3489
|
+
observer.onNext(value);
|
3490
|
+
}
|
3491
|
+
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3492
|
+
}, this);
|
3493
|
+
};
|
3287
3494
|
|
3288
3495
|
/**
|
3289
3496
|
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
|
@@ -3293,7 +3500,7 @@ if (!Array.prototype.forEach) {
|
|
3293
3500
|
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
|
3294
3501
|
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
3295
3502
|
*/
|
3296
|
-
observableProto['do'] = observableProto.
|
3503
|
+
observableProto['do'] = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
|
3297
3504
|
var source = this, onNextFunc;
|
3298
3505
|
if (typeof observerOrOnNext === 'function') {
|
3299
3506
|
onNextFunc = observerOrOnNext;
|
@@ -3329,7 +3536,13 @@ if (!Array.prototype.forEach) {
|
|
3329
3536
|
}
|
3330
3537
|
observer.onCompleted();
|
3331
3538
|
});
|
3332
|
-
});
|
3539
|
+
}, this);
|
3540
|
+
};
|
3541
|
+
|
3542
|
+
/** @deprecated use #do or #tap instead. */
|
3543
|
+
observableProto.doAction = function () {
|
3544
|
+
deprecate('doAction', 'do or tap');
|
3545
|
+
return this.tap.apply(this, arguments);
|
3333
3546
|
};
|
3334
3547
|
|
3335
3548
|
/**
|
@@ -3367,13 +3580,10 @@ if (!Array.prototype.forEach) {
|
|
3367
3580
|
|
3368
3581
|
/**
|
3369
3582
|
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
|
3370
|
-
*
|
3371
|
-
* @example
|
3372
|
-
* var res = observable.finallyAction(function () { console.log('sequence ended'; });
|
3373
3583
|
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
|
3374
3584
|
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
|
3375
3585
|
*/
|
3376
|
-
observableProto['finally'] = observableProto.
|
3586
|
+
observableProto['finally'] = observableProto.ensure = function (action) {
|
3377
3587
|
var source = this;
|
3378
3588
|
return new AnonymousObservable(function (observer) {
|
3379
3589
|
var subscription;
|
@@ -3392,7 +3602,15 @@ if (!Array.prototype.forEach) {
|
|
3392
3602
|
action();
|
3393
3603
|
}
|
3394
3604
|
});
|
3395
|
-
});
|
3605
|
+
}, this);
|
3606
|
+
};
|
3607
|
+
|
3608
|
+
/**
|
3609
|
+
* @deprecated use #finally or #ensure instead.
|
3610
|
+
*/
|
3611
|
+
observableProto.finallyAction = function (action) {
|
3612
|
+
deprecate('finallyAction', 'finally or ensure');
|
3613
|
+
return this.ensure(action);
|
3396
3614
|
};
|
3397
3615
|
|
3398
3616
|
/**
|
@@ -3403,7 +3621,7 @@ if (!Array.prototype.forEach) {
|
|
3403
3621
|
var source = this;
|
3404
3622
|
return new AnonymousObservable(function (observer) {
|
3405
3623
|
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3406
|
-
});
|
3624
|
+
}, source);
|
3407
3625
|
};
|
3408
3626
|
|
3409
3627
|
/**
|
@@ -3422,21 +3640,17 @@ if (!Array.prototype.forEach) {
|
|
3422
3640
|
observer.onNext(notificationCreateOnCompleted());
|
3423
3641
|
observer.onCompleted();
|
3424
3642
|
});
|
3425
|
-
});
|
3643
|
+
}, source);
|
3426
3644
|
};
|
3427
3645
|
|
3428
|
-
|
3429
|
-
|
3430
|
-
|
3431
|
-
|
3432
|
-
|
3433
|
-
|
3434
|
-
|
3435
|
-
|
3436
|
-
*/
|
3437
|
-
observableProto.repeat = function (repeatCount) {
|
3438
|
-
return enumerableRepeat(this, repeatCount).concat();
|
3439
|
-
};
|
3646
|
+
/**
|
3647
|
+
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
|
3648
|
+
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
|
3649
|
+
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
|
3650
|
+
*/
|
3651
|
+
observableProto.repeat = function (repeatCount) {
|
3652
|
+
return enumerableRepeat(this, repeatCount).concat();
|
3653
|
+
};
|
3440
3654
|
|
3441
3655
|
/**
|
3442
3656
|
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
|
@@ -3449,7 +3663,7 @@ if (!Array.prototype.forEach) {
|
|
3449
3663
|
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
|
3450
3664
|
*/
|
3451
3665
|
observableProto.retry = function (retryCount) {
|
3452
|
-
return enumerableRepeat(this, retryCount).
|
3666
|
+
return enumerableRepeat(this, retryCount).catchError();
|
3453
3667
|
};
|
3454
3668
|
|
3455
3669
|
/**
|
@@ -3496,7 +3710,7 @@ if (!Array.prototype.forEach) {
|
|
3496
3710
|
observer.onCompleted();
|
3497
3711
|
}
|
3498
3712
|
);
|
3499
|
-
});
|
3713
|
+
}, source);
|
3500
3714
|
};
|
3501
3715
|
|
3502
3716
|
/**
|
@@ -3515,7 +3729,7 @@ if (!Array.prototype.forEach) {
|
|
3515
3729
|
q.push(x);
|
3516
3730
|
q.length > count && observer.onNext(q.shift());
|
3517
3731
|
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3518
|
-
});
|
3732
|
+
}, source);
|
3519
3733
|
};
|
3520
3734
|
|
3521
3735
|
/**
|
@@ -3554,10 +3768,10 @@ if (!Array.prototype.forEach) {
|
|
3554
3768
|
q.push(x);
|
3555
3769
|
q.length > count && q.shift();
|
3556
3770
|
}, observer.onError.bind(observer), function () {
|
3557
|
-
while(q.length > 0) { observer.onNext(q.shift()); }
|
3771
|
+
while (q.length > 0) { observer.onNext(q.shift()); }
|
3558
3772
|
observer.onCompleted();
|
3559
3773
|
});
|
3560
|
-
});
|
3774
|
+
}, source);
|
3561
3775
|
};
|
3562
3776
|
|
3563
3777
|
/**
|
@@ -3580,7 +3794,7 @@ if (!Array.prototype.forEach) {
|
|
3580
3794
|
observer.onNext(q);
|
3581
3795
|
observer.onCompleted();
|
3582
3796
|
});
|
3583
|
-
});
|
3797
|
+
}, source);
|
3584
3798
|
};
|
3585
3799
|
|
3586
3800
|
/**
|
@@ -3620,27 +3834,27 @@ if (!Array.prototype.forEach) {
|
|
3620
3834
|
function (x) {
|
3621
3835
|
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
|
3622
3836
|
var c = n - count + 1;
|
3623
|
-
c >=0 && c % skip === 0 && q.shift().onCompleted();
|
3837
|
+
c >= 0 && c % skip === 0 && q.shift().onCompleted();
|
3624
3838
|
++n % skip === 0 && createWindow();
|
3625
|
-
},
|
3839
|
+
},
|
3626
3840
|
function (e) {
|
3627
3841
|
while (q.length > 0) { q.shift().onError(e); }
|
3628
3842
|
observer.onError(e);
|
3629
|
-
},
|
3843
|
+
},
|
3630
3844
|
function () {
|
3631
3845
|
while (q.length > 0) { q.shift().onCompleted(); }
|
3632
3846
|
observer.onCompleted();
|
3633
3847
|
}
|
3634
3848
|
));
|
3635
3849
|
return refCountDisposable;
|
3636
|
-
});
|
3850
|
+
}, source);
|
3637
3851
|
};
|
3638
3852
|
|
3639
3853
|
function concatMap(source, selector, thisArg) {
|
3640
3854
|
return source.map(function (x, i) {
|
3641
3855
|
var result = selector.call(thisArg, x, i, source);
|
3642
3856
|
isPromise(result) && (result = observableFromPromise(result));
|
3643
|
-
(
|
3857
|
+
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
|
3644
3858
|
return result;
|
3645
3859
|
}).concatAll();
|
3646
3860
|
}
|
@@ -3665,18 +3879,18 @@ if (!Array.prototype.forEach) {
|
|
3665
3879
|
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
|
3666
3880
|
*/
|
3667
3881
|
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
|
3668
|
-
if (
|
3882
|
+
if (isFunction(selector) && isFunction(resultSelector)) {
|
3669
3883
|
return this.concatMap(function (x, i) {
|
3670
3884
|
var selectorResult = selector(x, i);
|
3671
3885
|
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
|
3672
|
-
(
|
3886
|
+
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
|
3673
3887
|
|
3674
3888
|
return selectorResult.map(function (y, i2) {
|
3675
3889
|
return resultSelector(x, y, i, i2);
|
3676
3890
|
});
|
3677
3891
|
});
|
3678
3892
|
}
|
3679
|
-
return
|
3893
|
+
return isFunction(selector) ?
|
3680
3894
|
concatMap(this, selector, thisArg) :
|
3681
3895
|
concatMap(this, function () { return selector; });
|
3682
3896
|
};
|
@@ -3730,7 +3944,7 @@ if (!Array.prototype.forEach) {
|
|
3730
3944
|
observer.onNext(result);
|
3731
3945
|
observer.onCompleted();
|
3732
3946
|
});
|
3733
|
-
}).concatAll();
|
3947
|
+
}, this).concatAll();
|
3734
3948
|
};
|
3735
3949
|
|
3736
3950
|
/**
|
@@ -3744,22 +3958,18 @@ if (!Array.prototype.forEach) {
|
|
3744
3958
|
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
|
3745
3959
|
*/
|
3746
3960
|
observableProto.defaultIfEmpty = function (defaultValue) {
|
3747
|
-
|
3748
|
-
|
3749
|
-
|
3750
|
-
|
3751
|
-
return
|
3752
|
-
|
3753
|
-
|
3754
|
-
|
3755
|
-
|
3756
|
-
|
3757
|
-
if (!found) {
|
3758
|
-
observer.onNext(defaultValue);
|
3759
|
-
}
|
3760
|
-
observer.onCompleted();
|
3761
|
-
});
|
3961
|
+
var source = this;
|
3962
|
+
defaultValue === undefined && (defaultValue = null);
|
3963
|
+
return new AnonymousObservable(function (observer) {
|
3964
|
+
var found = false;
|
3965
|
+
return source.subscribe(function (x) {
|
3966
|
+
found = true;
|
3967
|
+
observer.onNext(x);
|
3968
|
+
}, observer.onError.bind(observer), function () {
|
3969
|
+
!found && observer.onNext(defaultValue);
|
3970
|
+
observer.onCompleted();
|
3762
3971
|
});
|
3972
|
+
}, this);
|
3763
3973
|
};
|
3764
3974
|
|
3765
3975
|
// Swap out for Array.findIndex
|
@@ -3812,30 +4022,31 @@ if (!Array.prototype.forEach) {
|
|
3812
4022
|
},
|
3813
4023
|
observer.onError.bind(observer),
|
3814
4024
|
observer.onCompleted.bind(observer));
|
3815
|
-
});
|
4025
|
+
}, this);
|
3816
4026
|
};
|
3817
4027
|
|
3818
4028
|
/**
|
3819
|
-
*
|
4029
|
+
* Projects each element of an observable sequence into a new form by incorporating the element's index.
|
3820
4030
|
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
|
3821
4031
|
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3822
4032
|
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
|
3823
4033
|
*/
|
3824
4034
|
observableProto.select = observableProto.map = function (selector, thisArg) {
|
3825
|
-
var
|
4035
|
+
var selectorFn = isFunction(selector) ? selector : function () { return selector; },
|
4036
|
+
source = this;
|
3826
4037
|
return new AnonymousObservable(function (observer) {
|
3827
4038
|
var count = 0;
|
3828
|
-
return
|
4039
|
+
return source.subscribe(function (value) {
|
3829
4040
|
var result;
|
3830
4041
|
try {
|
3831
|
-
result =
|
4042
|
+
result = selectorFn.call(thisArg, value, count++, source);
|
3832
4043
|
} catch (e) {
|
3833
4044
|
observer.onError(e);
|
3834
4045
|
return;
|
3835
4046
|
}
|
3836
4047
|
observer.onNext(result);
|
3837
4048
|
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3838
|
-
});
|
4049
|
+
}, source);
|
3839
4050
|
};
|
3840
4051
|
|
3841
4052
|
/**
|
@@ -3851,9 +4062,9 @@ if (!Array.prototype.forEach) {
|
|
3851
4062
|
return source.map(function (x, i) {
|
3852
4063
|
var result = selector.call(thisArg, x, i, source);
|
3853
4064
|
isPromise(result) && (result = observableFromPromise(result));
|
3854
|
-
(
|
4065
|
+
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
|
3855
4066
|
return result;
|
3856
|
-
}).
|
4067
|
+
}).mergeAll();
|
3857
4068
|
}
|
3858
4069
|
|
3859
4070
|
/**
|
@@ -3876,18 +4087,18 @@ if (!Array.prototype.forEach) {
|
|
3876
4087
|
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
|
3877
4088
|
*/
|
3878
4089
|
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
|
3879
|
-
if (
|
4090
|
+
if (isFunction(selector) && isFunction(resultSelector)) {
|
3880
4091
|
return this.flatMap(function (x, i) {
|
3881
4092
|
var selectorResult = selector(x, i);
|
3882
4093
|
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
|
3883
|
-
(
|
4094
|
+
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
|
3884
4095
|
|
3885
4096
|
return selectorResult.map(function (y, i2) {
|
3886
4097
|
return resultSelector(x, y, i, i2);
|
3887
4098
|
});
|
3888
4099
|
}, thisArg);
|
3889
4100
|
}
|
3890
|
-
return
|
4101
|
+
return isFunction(selector) ?
|
3891
4102
|
flatMap(this, selector, thisArg) :
|
3892
4103
|
flatMap(this, function () { return selector; });
|
3893
4104
|
};
|
@@ -3941,7 +4152,7 @@ if (!Array.prototype.forEach) {
|
|
3941
4152
|
observer.onNext(result);
|
3942
4153
|
observer.onCompleted();
|
3943
4154
|
});
|
3944
|
-
}).mergeAll();
|
4155
|
+
}, source).mergeAll();
|
3945
4156
|
};
|
3946
4157
|
|
3947
4158
|
/**
|
@@ -3962,18 +4173,18 @@ if (!Array.prototype.forEach) {
|
|
3962
4173
|
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
|
3963
4174
|
*/
|
3964
4175
|
observableProto.skip = function (count) {
|
3965
|
-
|
3966
|
-
|
3967
|
-
|
3968
|
-
|
3969
|
-
|
3970
|
-
|
3971
|
-
|
3972
|
-
|
3973
|
-
|
3974
|
-
|
3975
|
-
|
3976
|
-
|
4176
|
+
if (count < 0) { throw new Error(argumentOutOfRange); }
|
4177
|
+
var source = this;
|
4178
|
+
return new AnonymousObservable(function (observer) {
|
4179
|
+
var remaining = count;
|
4180
|
+
return source.subscribe(function (x) {
|
4181
|
+
if (remaining <= 0) {
|
4182
|
+
observer.onNext(x);
|
4183
|
+
} else {
|
4184
|
+
remaining--;
|
4185
|
+
}
|
4186
|
+
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
4187
|
+
}, source);
|
3977
4188
|
};
|
3978
4189
|
|
3979
4190
|
/**
|
@@ -4001,7 +4212,7 @@ if (!Array.prototype.forEach) {
|
|
4001
4212
|
}
|
4002
4213
|
running && observer.onNext(x);
|
4003
4214
|
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
4004
|
-
});
|
4215
|
+
}, source);
|
4005
4216
|
};
|
4006
4217
|
|
4007
4218
|
/**
|
@@ -4014,18 +4225,18 @@ if (!Array.prototype.forEach) {
|
|
4014
4225
|
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
|
4015
4226
|
*/
|
4016
4227
|
observableProto.take = function (count, scheduler) {
|
4017
|
-
|
4018
|
-
|
4019
|
-
|
4020
|
-
|
4021
|
-
|
4022
|
-
|
4023
|
-
|
4024
|
-
|
4025
|
-
|
4026
|
-
|
4027
|
-
|
4028
|
-
|
4228
|
+
if (count < 0) { throw new RangeError(argumentOutOfRange); }
|
4229
|
+
if (count === 0) { return observableEmpty(scheduler); }
|
4230
|
+
var source = this;
|
4231
|
+
return new AnonymousObservable(function (observer) {
|
4232
|
+
var remaining = count;
|
4233
|
+
return source.subscribe(function (x) {
|
4234
|
+
if (remaining-- > 0) {
|
4235
|
+
observer.onNext(x);
|
4236
|
+
remaining === 0 && observer.onCompleted();
|
4237
|
+
}
|
4238
|
+
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
4239
|
+
}, source);
|
4029
4240
|
};
|
4030
4241
|
|
4031
4242
|
/**
|
@@ -4036,13 +4247,13 @@ if (!Array.prototype.forEach) {
|
|
4036
4247
|
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
|
4037
4248
|
*/
|
4038
4249
|
observableProto.takeWhile = function (predicate, thisArg) {
|
4039
|
-
var
|
4250
|
+
var source = this;
|
4040
4251
|
return new AnonymousObservable(function (observer) {
|
4041
4252
|
var i = 0, running = true;
|
4042
|
-
return
|
4253
|
+
return source.subscribe(function (x) {
|
4043
4254
|
if (running) {
|
4044
4255
|
try {
|
4045
|
-
running = predicate.call(thisArg, x, i++,
|
4256
|
+
running = predicate.call(thisArg, x, i++, source);
|
4046
4257
|
} catch (e) {
|
4047
4258
|
observer.onError(e);
|
4048
4259
|
return;
|
@@ -4054,7 +4265,7 @@ if (!Array.prototype.forEach) {
|
|
4054
4265
|
}
|
4055
4266
|
}
|
4056
4267
|
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
4057
|
-
});
|
4268
|
+
}, source);
|
4058
4269
|
};
|
4059
4270
|
|
4060
4271
|
/**
|
@@ -4068,24 +4279,24 @@ if (!Array.prototype.forEach) {
|
|
4068
4279
|
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
|
4069
4280
|
*/
|
4070
4281
|
observableProto.where = observableProto.filter = function (predicate, thisArg) {
|
4071
|
-
|
4072
|
-
|
4073
|
-
|
4074
|
-
|
4075
|
-
|
4076
|
-
|
4077
|
-
|
4078
|
-
|
4079
|
-
|
4080
|
-
|
4081
|
-
|
4082
|
-
|
4083
|
-
|
4084
|
-
|
4282
|
+
var source = this;
|
4283
|
+
return new AnonymousObservable(function (observer) {
|
4284
|
+
var count = 0;
|
4285
|
+
return source.subscribe(function (value) {
|
4286
|
+
var shouldRun;
|
4287
|
+
try {
|
4288
|
+
shouldRun = predicate.call(thisArg, value, count++, parent);
|
4289
|
+
} catch (e) {
|
4290
|
+
observer.onError(e);
|
4291
|
+
return;
|
4292
|
+
}
|
4293
|
+
shouldRun && observer.onNext(value);
|
4294
|
+
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
4295
|
+
}, source);
|
4085
4296
|
};
|
4086
4297
|
|
4087
4298
|
/**
|
4088
|
-
* Executes a transducer to transform the observable sequence
|
4299
|
+
* Executes a transducer to transform the observable sequence
|
4089
4300
|
* @param {Transducer} transducer A transducer to execute
|
4090
4301
|
* @returns {Observable} An Observable sequence containing the results from the transducer.
|
4091
4302
|
*/
|
@@ -4109,17 +4320,17 @@ if (!Array.prototype.forEach) {
|
|
4109
4320
|
return new AnonymousObservable(function(observer) {
|
4110
4321
|
var xform = transducer(transformForObserver(observer));
|
4111
4322
|
return source.subscribe(
|
4112
|
-
function(v) {
|
4323
|
+
function(v) {
|
4113
4324
|
try {
|
4114
4325
|
xform.step(observer, v);
|
4115
4326
|
} catch (e) {
|
4116
4327
|
observer.onError(e);
|
4117
4328
|
}
|
4118
|
-
},
|
4119
|
-
observer.onError.bind(observer),
|
4329
|
+
},
|
4330
|
+
observer.onError.bind(observer),
|
4120
4331
|
function() { xform.result(observer); }
|
4121
4332
|
);
|
4122
|
-
});
|
4333
|
+
}, source);
|
4123
4334
|
};
|
4124
4335
|
|
4125
4336
|
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
|
@@ -4134,7 +4345,8 @@ if (!Array.prototype.forEach) {
|
|
4134
4345
|
disposableEmpty;
|
4135
4346
|
}
|
4136
4347
|
|
4137
|
-
function AnonymousObservable(subscribe) {
|
4348
|
+
function AnonymousObservable(subscribe, parent) {
|
4349
|
+
this.source = parent;
|
4138
4350
|
if (!(this instanceof AnonymousObservable)) {
|
4139
4351
|
return new AnonymousObservable(subscribe);
|
4140
4352
|
}
|
@@ -4167,66 +4379,59 @@ if (!Array.prototype.forEach) {
|
|
4167
4379
|
|
4168
4380
|
}(Observable));
|
4169
4381
|
|
4170
|
-
|
4171
|
-
|
4172
|
-
inherits(AutoDetachObserver, _super);
|
4382
|
+
var AutoDetachObserver = (function (__super__) {
|
4383
|
+
inherits(AutoDetachObserver, __super__);
|
4173
4384
|
|
4174
|
-
|
4175
|
-
|
4176
|
-
|
4177
|
-
|
4178
|
-
|
4385
|
+
function AutoDetachObserver(observer) {
|
4386
|
+
__super__.call(this);
|
4387
|
+
this.observer = observer;
|
4388
|
+
this.m = new SingleAssignmentDisposable();
|
4389
|
+
}
|
4179
4390
|
|
4180
|
-
|
4391
|
+
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
|
4181
4392
|
|
4182
|
-
|
4183
|
-
|
4184
|
-
|
4185
|
-
|
4186
|
-
|
4187
|
-
|
4188
|
-
|
4189
|
-
|
4190
|
-
|
4191
|
-
|
4192
|
-
|
4193
|
-
}
|
4194
|
-
};
|
4393
|
+
AutoDetachObserverPrototype.next = function (value) {
|
4394
|
+
var noError = false;
|
4395
|
+
try {
|
4396
|
+
this.observer.onNext(value);
|
4397
|
+
noError = true;
|
4398
|
+
} catch (e) {
|
4399
|
+
throw e;
|
4400
|
+
} finally {
|
4401
|
+
!noError && this.dispose();
|
4402
|
+
}
|
4403
|
+
};
|
4195
4404
|
|
4196
|
-
|
4197
|
-
|
4198
|
-
|
4199
|
-
|
4200
|
-
|
4201
|
-
|
4202
|
-
|
4203
|
-
|
4204
|
-
|
4405
|
+
AutoDetachObserverPrototype.error = function (err) {
|
4406
|
+
try {
|
4407
|
+
this.observer.onError(err);
|
4408
|
+
} catch (e) {
|
4409
|
+
throw e;
|
4410
|
+
} finally {
|
4411
|
+
this.dispose();
|
4412
|
+
}
|
4413
|
+
};
|
4205
4414
|
|
4206
|
-
|
4207
|
-
|
4208
|
-
|
4209
|
-
|
4210
|
-
|
4211
|
-
|
4212
|
-
|
4213
|
-
|
4214
|
-
|
4415
|
+
AutoDetachObserverPrototype.completed = function () {
|
4416
|
+
try {
|
4417
|
+
this.observer.onCompleted();
|
4418
|
+
} catch (e) {
|
4419
|
+
throw e;
|
4420
|
+
} finally {
|
4421
|
+
this.dispose();
|
4422
|
+
}
|
4423
|
+
};
|
4215
4424
|
|
4216
|
-
|
4217
|
-
|
4218
|
-
/* @private */
|
4219
|
-
AutoDetachObserverPrototype.disposable = function (value) {
|
4220
|
-
return arguments.length ? this.getDisposable() : setDisposable(value);
|
4221
|
-
};
|
4425
|
+
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
|
4426
|
+
AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); };
|
4222
4427
|
|
4223
|
-
|
4224
|
-
|
4225
|
-
|
4226
|
-
|
4428
|
+
AutoDetachObserverPrototype.dispose = function () {
|
4429
|
+
__super__.prototype.dispose.call(this);
|
4430
|
+
this.m.dispose();
|
4431
|
+
};
|
4227
4432
|
|
4228
|
-
|
4229
|
-
|
4433
|
+
return AutoDetachObserver;
|
4434
|
+
}(AbstractObserver));
|
4230
4435
|
|
4231
4436
|
/** @private */
|
4232
4437
|
var InnerSubscription = function (subject, observer) {
|
@@ -4520,4 +4725,7 @@ if (!Array.prototype.forEach) {
|
|
4520
4725
|
root.Rx = Rx;
|
4521
4726
|
}
|
4522
4727
|
|
4728
|
+
// All code before this point will be filtered from stack traces.
|
4729
|
+
var rEndingLine = captureLine();
|
4730
|
+
|
4523
4731
|
}.call(this));
|