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:
|
@@ -968,15 +1081,13 @@
|
|
968
1081
|
|
969
1082
|
}(Scheduler.prototype));
|
970
1083
|
|
971
|
-
/**
|
972
|
-
* Gets a scheduler that schedules work immediately on the current thread.
|
973
|
-
*/
|
1084
|
+
/** Gets a scheduler that schedules work immediately on the current thread. */
|
974
1085
|
var immediateScheduler = Scheduler.immediate = (function () {
|
975
1086
|
|
976
1087
|
function scheduleNow(state, action) { return action(this, state); }
|
977
1088
|
|
978
1089
|
function scheduleRelative(state, dueTime, action) {
|
979
|
-
var dt = normalizeTime(
|
1090
|
+
var dt = normalizeTime(dueTime);
|
980
1091
|
while (dt - this.now() > 0) { }
|
981
1092
|
return action(this, state);
|
982
1093
|
}
|
@@ -1119,24 +1230,24 @@
|
|
1119
1230
|
oldHandler = root.onmessage;
|
1120
1231
|
// Test for async
|
1121
1232
|
root.onmessage = function () { isAsync = true; };
|
1122
|
-
root.postMessage('','*');
|
1233
|
+
root.postMessage('', '*');
|
1123
1234
|
root.onmessage = oldHandler;
|
1124
1235
|
|
1125
1236
|
return isAsync;
|
1126
1237
|
}
|
1127
1238
|
|
1128
|
-
// Use in order,
|
1129
|
-
if (typeof
|
1130
|
-
scheduleMethod = process.nextTick;
|
1131
|
-
} else if (typeof setImmediate === 'function') {
|
1239
|
+
// Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
|
1240
|
+
if (typeof setImmediate === 'function') {
|
1132
1241
|
scheduleMethod = setImmediate;
|
1133
1242
|
clearMethod = clearImmediate;
|
1243
|
+
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
|
1244
|
+
scheduleMethod = process.nextTick;
|
1134
1245
|
} else if (postMessageSupported()) {
|
1135
1246
|
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
|
1136
1247
|
tasks = {},
|
1137
1248
|
taskId = 0;
|
1138
1249
|
|
1139
|
-
function
|
1250
|
+
var onGlobalPostMessage = function (event) {
|
1140
1251
|
// Only if we're a match to avoid any other global events
|
1141
1252
|
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
|
1142
1253
|
var handleId = event.data.substring(MSG_PREFIX.length),
|
@@ -1365,8 +1476,8 @@
|
|
1365
1476
|
var e;
|
1366
1477
|
try {
|
1367
1478
|
e = sources[$iterator$]();
|
1368
|
-
} catch(err) {
|
1369
|
-
observer.onError();
|
1479
|
+
} catch (err) {
|
1480
|
+
observer.onError(err);
|
1370
1481
|
return;
|
1371
1482
|
}
|
1372
1483
|
|
@@ -1407,14 +1518,14 @@
|
|
1407
1518
|
});
|
1408
1519
|
};
|
1409
1520
|
|
1410
|
-
Enumerable.prototype.
|
1521
|
+
Enumerable.prototype.catchError = function () {
|
1411
1522
|
var sources = this;
|
1412
1523
|
return new AnonymousObservable(function (observer) {
|
1413
1524
|
var e;
|
1414
1525
|
try {
|
1415
1526
|
e = sources[$iterator$]();
|
1416
|
-
} catch(err) {
|
1417
|
-
observer.onError();
|
1527
|
+
} catch (err) {
|
1528
|
+
observer.onError(err);
|
1418
1529
|
return;
|
1419
1530
|
}
|
1420
1531
|
|
@@ -1654,6 +1765,24 @@
|
|
1654
1765
|
var Observable = Rx.Observable = (function () {
|
1655
1766
|
|
1656
1767
|
function Observable(subscribe) {
|
1768
|
+
if (Rx.config.longStackSupport && hasStacks) {
|
1769
|
+
try {
|
1770
|
+
throw new Error();
|
1771
|
+
} catch (e) {
|
1772
|
+
this.stack = e.stack.substring(e.stack.indexOf("\n") + 1);
|
1773
|
+
}
|
1774
|
+
|
1775
|
+
var self = this;
|
1776
|
+
this._subscribe = function (observer) {
|
1777
|
+
observer.onError = function (err) {
|
1778
|
+
makeStackTraceLong(self, err);
|
1779
|
+
observer.onError(err);
|
1780
|
+
};
|
1781
|
+
|
1782
|
+
subscribe(observer);
|
1783
|
+
};
|
1784
|
+
}
|
1785
|
+
|
1657
1786
|
this._subscribe = subscribe;
|
1658
1787
|
}
|
1659
1788
|
|
@@ -1720,23 +1849,17 @@
|
|
1720
1849
|
|
1721
1850
|
ScheduledObserver.prototype.next = function (value) {
|
1722
1851
|
var self = this;
|
1723
|
-
this.queue.push(function () {
|
1724
|
-
self.observer.onNext(value);
|
1725
|
-
});
|
1852
|
+
this.queue.push(function () { self.observer.onNext(value); });
|
1726
1853
|
};
|
1727
1854
|
|
1728
|
-
ScheduledObserver.prototype.error = function (
|
1855
|
+
ScheduledObserver.prototype.error = function (e) {
|
1729
1856
|
var self = this;
|
1730
|
-
this.queue.push(function () {
|
1731
|
-
self.observer.onError(err);
|
1732
|
-
});
|
1857
|
+
this.queue.push(function () { self.observer.onError(e); });
|
1733
1858
|
};
|
1734
1859
|
|
1735
1860
|
ScheduledObserver.prototype.completed = function () {
|
1736
1861
|
var self = this;
|
1737
|
-
this.queue.push(function () {
|
1738
|
-
self.observer.onCompleted();
|
1739
|
-
});
|
1862
|
+
this.queue.push(function () { self.observer.onCompleted(); });
|
1740
1863
|
};
|
1741
1864
|
|
1742
1865
|
ScheduledObserver.prototype.ensureActive = function () {
|
@@ -1775,36 +1898,34 @@
|
|
1775
1898
|
}(AbstractObserver));
|
1776
1899
|
|
1777
1900
|
/**
|
1778
|
-
* Creates
|
1779
|
-
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
|
1901
|
+
* Creates an array from an observable sequence.
|
1902
|
+
* @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.
|
1780
1903
|
*/
|
1781
1904
|
observableProto.toArray = function () {
|
1782
|
-
var
|
1905
|
+
var source = this;
|
1783
1906
|
return new AnonymousObservable(function(observer) {
|
1784
1907
|
var arr = [];
|
1785
|
-
return
|
1908
|
+
return source.subscribe(
|
1786
1909
|
arr.push.bind(arr),
|
1787
1910
|
observer.onError.bind(observer),
|
1788
1911
|
function () {
|
1789
1912
|
observer.onNext(arr);
|
1790
1913
|
observer.onCompleted();
|
1791
1914
|
});
|
1792
|
-
});
|
1915
|
+
}, source);
|
1793
1916
|
};
|
1794
1917
|
|
1795
1918
|
/**
|
1796
1919
|
* Creates an observable sequence from a specified subscribe method implementation.
|
1797
|
-
*
|
1798
1920
|
* @example
|
1799
1921
|
* var res = Rx.Observable.create(function (observer) { return function () { } );
|
1800
1922
|
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
|
1801
1923
|
* var res = Rx.Observable.create(function (observer) { } );
|
1802
|
-
*
|
1803
1924
|
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
|
1804
1925
|
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
|
1805
1926
|
*/
|
1806
|
-
Observable.create = Observable.createWithDisposable = function (subscribe) {
|
1807
|
-
return new AnonymousObservable(subscribe);
|
1927
|
+
Observable.create = Observable.createWithDisposable = function (subscribe, parent) {
|
1928
|
+
return new AnonymousObservable(subscribe, parent);
|
1808
1929
|
};
|
1809
1930
|
|
1810
1931
|
/**
|
@@ -1848,6 +1969,60 @@
|
|
1848
1969
|
|
1849
1970
|
var maxSafeInteger = Math.pow(2, 53) - 1;
|
1850
1971
|
|
1972
|
+
function StringIterable(str) {
|
1973
|
+
this._s = s;
|
1974
|
+
}
|
1975
|
+
|
1976
|
+
StringIterable.prototype[$iterator$] = function () {
|
1977
|
+
return new StringIterator(this._s);
|
1978
|
+
};
|
1979
|
+
|
1980
|
+
function StringIterator(str) {
|
1981
|
+
this._s = s;
|
1982
|
+
this._l = s.length;
|
1983
|
+
this._i = 0;
|
1984
|
+
}
|
1985
|
+
|
1986
|
+
StringIterator.prototype[$iterator$] = function () {
|
1987
|
+
return this;
|
1988
|
+
};
|
1989
|
+
|
1990
|
+
StringIterator.prototype.next = function () {
|
1991
|
+
if (this._i < this._l) {
|
1992
|
+
var val = this._s.charAt(this._i++);
|
1993
|
+
return { done: false, value: val };
|
1994
|
+
} else {
|
1995
|
+
return doneEnumerator;
|
1996
|
+
}
|
1997
|
+
};
|
1998
|
+
|
1999
|
+
function ArrayIterable(a) {
|
2000
|
+
this._a = a;
|
2001
|
+
}
|
2002
|
+
|
2003
|
+
ArrayIterable.prototype[$iterator$] = function () {
|
2004
|
+
return new ArrayIterator(this._a);
|
2005
|
+
};
|
2006
|
+
|
2007
|
+
function ArrayIterator(a) {
|
2008
|
+
this._a = a;
|
2009
|
+
this._l = toLength(a);
|
2010
|
+
this._i = 0;
|
2011
|
+
}
|
2012
|
+
|
2013
|
+
ArrayIterator.prototype[$iterator$] = function () {
|
2014
|
+
return this;
|
2015
|
+
};
|
2016
|
+
|
2017
|
+
ArrayIterator.prototype.next = function () {
|
2018
|
+
if (this._i < this._l) {
|
2019
|
+
var val = this._a[this._i++];
|
2020
|
+
return { done: false, value: val };
|
2021
|
+
} else {
|
2022
|
+
return doneEnumerator;
|
2023
|
+
}
|
2024
|
+
};
|
2025
|
+
|
1851
2026
|
function numberIsFinite(value) {
|
1852
2027
|
return typeof value === 'number' && root.isFinite(value);
|
1853
2028
|
}
|
@@ -1856,8 +2031,18 @@
|
|
1856
2031
|
return n !== n;
|
1857
2032
|
}
|
1858
2033
|
|
1859
|
-
function
|
1860
|
-
|
2034
|
+
function getIterable(o) {
|
2035
|
+
var i = o[$iterator$], it;
|
2036
|
+
if (!i && typeof o === 'string') {
|
2037
|
+
it = new StringIterable(o);
|
2038
|
+
return it[$iterator$]();
|
2039
|
+
}
|
2040
|
+
if (!i && o.length !== undefined) {
|
2041
|
+
it = new ArrayIterable(o);
|
2042
|
+
return it[$iterator$]();
|
2043
|
+
}
|
2044
|
+
if (!i) { throw new TypeError('Object is not iterable'); }
|
2045
|
+
return o[$iterator$]();
|
1861
2046
|
}
|
1862
2047
|
|
1863
2048
|
function sign(value) {
|
@@ -1877,10 +2062,6 @@
|
|
1877
2062
|
return len;
|
1878
2063
|
}
|
1879
2064
|
|
1880
|
-
function isCallable(f) {
|
1881
|
-
return Object.prototype.toString.call(f) === '[object Function]' && typeof f === 'function';
|
1882
|
-
}
|
1883
|
-
|
1884
2065
|
/**
|
1885
2066
|
* This method creates a new Observable sequence from an array-like or iterable object.
|
1886
2067
|
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
|
@@ -1892,66 +2073,52 @@
|
|
1892
2073
|
if (iterable == null) {
|
1893
2074
|
throw new Error('iterable cannot be null.')
|
1894
2075
|
}
|
1895
|
-
if (mapFn && !
|
2076
|
+
if (mapFn && !isFunction(mapFn)) {
|
1896
2077
|
throw new Error('mapFn when provided must be a function');
|
1897
2078
|
}
|
1898
2079
|
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
|
2080
|
+
var list = Object(iterable), it = getIterable(list);
|
1899
2081
|
return new AnonymousObservable(function (observer) {
|
1900
|
-
var
|
1901
|
-
objIsIterable = isIterable(list),
|
1902
|
-
len = objIsIterable ? 0 : toLength(list),
|
1903
|
-
it = objIsIterable ? list[$iterator$]() : null,
|
1904
|
-
i = 0;
|
2082
|
+
var i = 0;
|
1905
2083
|
return scheduler.scheduleRecursive(function (self) {
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
observer.onCompleted();
|
1918
|
-
return;
|
1919
|
-
}
|
2084
|
+
var next;
|
2085
|
+
try {
|
2086
|
+
next = it.next();
|
2087
|
+
} catch (e) {
|
2088
|
+
observer.onError(e);
|
2089
|
+
return;
|
2090
|
+
}
|
2091
|
+
if (next.done) {
|
2092
|
+
observer.onCompleted();
|
2093
|
+
return;
|
2094
|
+
}
|
1920
2095
|
|
1921
|
-
|
1922
|
-
} else {
|
1923
|
-
result = !!list.charAt ? list.charAt(i) : list[i];
|
1924
|
-
}
|
2096
|
+
var result = next.value;
|
1925
2097
|
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
}
|
2098
|
+
if (mapFn && isFunction(mapFn)) {
|
2099
|
+
try {
|
2100
|
+
result = mapFn.call(thisArg, result, i);
|
2101
|
+
} catch (e) {
|
2102
|
+
observer.onError(e);
|
2103
|
+
return;
|
1933
2104
|
}
|
1934
|
-
|
1935
|
-
observer.onNext(result);
|
1936
|
-
i++;
|
1937
|
-
self();
|
1938
|
-
} else {
|
1939
|
-
observer.onCompleted();
|
1940
2105
|
}
|
2106
|
+
|
2107
|
+
observer.onNext(result);
|
2108
|
+
i++;
|
2109
|
+
self();
|
1941
2110
|
});
|
1942
2111
|
});
|
1943
2112
|
};
|
1944
2113
|
|
1945
2114
|
/**
|
1946
2115
|
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
|
1947
|
-
*
|
1948
|
-
* @example
|
1949
|
-
* var res = Rx.Observable.fromArray([1,2,3]);
|
1950
|
-
* var res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
|
2116
|
+
* @deprecated use Observable.from or Observable.of
|
1951
2117
|
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
|
1952
2118
|
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
|
1953
2119
|
*/
|
1954
2120
|
var observableFromArray = Observable.fromArray = function (array, scheduler) {
|
2121
|
+
deprecate('fromArray', 'from');
|
1955
2122
|
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
|
1956
2123
|
return new AnonymousObservable(function (observer) {
|
1957
2124
|
var count = 0, len = array.length;
|
@@ -1976,29 +2143,36 @@
|
|
1976
2143
|
});
|
1977
2144
|
};
|
1978
2145
|
|
2146
|
+
function observableOf (scheduler, array) {
|
2147
|
+
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
|
2148
|
+
return new AnonymousObservable(function (observer) {
|
2149
|
+
var count = 0, len = array.length;
|
2150
|
+
return scheduler.scheduleRecursive(function (self) {
|
2151
|
+
if (count < len) {
|
2152
|
+
observer.onNext(array[count++]);
|
2153
|
+
self();
|
2154
|
+
} else {
|
2155
|
+
observer.onCompleted();
|
2156
|
+
}
|
2157
|
+
});
|
2158
|
+
});
|
2159
|
+
}
|
2160
|
+
|
1979
2161
|
/**
|
1980
2162
|
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
|
1981
|
-
* @example
|
1982
|
-
* var res = Rx.Observable.of(1,2,3);
|
1983
2163
|
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
|
1984
2164
|
*/
|
1985
2165
|
Observable.of = function () {
|
1986
|
-
|
1987
|
-
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
1988
|
-
return observableFromArray(args);
|
2166
|
+
return observableOf(null, arguments);
|
1989
2167
|
};
|
1990
2168
|
|
1991
2169
|
/**
|
1992
2170
|
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
|
1993
|
-
* @example
|
1994
|
-
* var res = Rx.Observable.of(1,2,3);
|
1995
2171
|
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
|
1996
2172
|
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
|
1997
2173
|
*/
|
1998
|
-
|
1999
|
-
|
2000
|
-
for(var i = 0; i < len; i++) { args[i] = arguments[i + 1]; }
|
2001
|
-
return observableFromArray(args, scheduler);
|
2174
|
+
Observable.ofWithScheduler = function (scheduler) {
|
2175
|
+
return observableOf(scheduler, slice.call(arguments, 1));
|
2002
2176
|
};
|
2003
2177
|
|
2004
2178
|
/**
|
@@ -2055,7 +2229,7 @@
|
|
2055
2229
|
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
|
2056
2230
|
* @returns {Observable} An observable sequence containing the single specified element.
|
2057
2231
|
*/
|
2058
|
-
var observableReturn = Observable['return'] = Observable.
|
2232
|
+
var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {
|
2059
2233
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
2060
2234
|
return new AnonymousObservable(function (observer) {
|
2061
2235
|
return scheduler.schedule(function () {
|
@@ -2065,6 +2239,12 @@
|
|
2065
2239
|
});
|
2066
2240
|
};
|
2067
2241
|
|
2242
|
+
/** @deprecated use return or just */
|
2243
|
+
Observable.returnValue = function () {
|
2244
|
+
deprecate('returnValue', 'return or just');
|
2245
|
+
return observableReturn.apply(null, arguments);
|
2246
|
+
};
|
2247
|
+
|
2068
2248
|
/**
|
2069
2249
|
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
|
2070
2250
|
* There is an alias to this method called 'throwError' for browsers <IE9.
|
@@ -2101,7 +2281,7 @@
|
|
2101
2281
|
}, observer.onCompleted.bind(observer)));
|
2102
2282
|
|
2103
2283
|
return subscription;
|
2104
|
-
});
|
2284
|
+
}, source);
|
2105
2285
|
}
|
2106
2286
|
|
2107
2287
|
/**
|
@@ -2112,19 +2292,35 @@
|
|
2112
2292
|
* @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.
|
2113
2293
|
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
|
2114
2294
|
*/
|
2115
|
-
observableProto['catch'] = observableProto.catchError =
|
2295
|
+
observableProto['catch'] = observableProto.catchError = function (handlerOrSecond) {
|
2116
2296
|
return typeof handlerOrSecond === 'function' ?
|
2117
2297
|
observableCatchHandler(this, handlerOrSecond) :
|
2118
2298
|
observableCatch([this, handlerOrSecond]);
|
2119
2299
|
};
|
2120
2300
|
|
2301
|
+
/**
|
2302
|
+
* @deprecated use #catch or #catchError instead.
|
2303
|
+
*/
|
2304
|
+
observableProto.catchException = function (handlerOrSecond) {
|
2305
|
+
deprecate('catchException', 'catch or catchError');
|
2306
|
+
return this.catchError(handlerOrSecond);
|
2307
|
+
};
|
2308
|
+
|
2121
2309
|
/**
|
2122
2310
|
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
|
2123
2311
|
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
|
2124
2312
|
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
|
2125
2313
|
*/
|
2126
|
-
var observableCatch = Observable.
|
2127
|
-
return enumerableOf(argsOrArray(arguments, 0)).
|
2314
|
+
var observableCatch = Observable.catchError = Observable['catch'] = function () {
|
2315
|
+
return enumerableOf(argsOrArray(arguments, 0)).catchError();
|
2316
|
+
};
|
2317
|
+
|
2318
|
+
/**
|
2319
|
+
* @deprecated use #catch or #catchError instead.
|
2320
|
+
*/
|
2321
|
+
Observable.catchException = function () {
|
2322
|
+
deprecate('catchException', 'catch or catchError');
|
2323
|
+
return observableCatch.apply(null, arguments);
|
2128
2324
|
};
|
2129
2325
|
|
2130
2326
|
/**
|
@@ -2208,7 +2404,7 @@
|
|
2208
2404
|
}
|
2209
2405
|
|
2210
2406
|
return new CompositeDisposable(subscriptions);
|
2211
|
-
});
|
2407
|
+
}, this);
|
2212
2408
|
};
|
2213
2409
|
|
2214
2410
|
/**
|
@@ -2234,13 +2430,19 @@
|
|
2234
2430
|
return enumerableOf(argsOrArray(arguments, 0)).concat();
|
2235
2431
|
};
|
2236
2432
|
|
2237
|
-
|
2238
|
-
|
2239
|
-
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
|
2433
|
+
/**
|
2434
|
+
* Concatenates an observable sequence of observable sequences.
|
2435
|
+
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
|
2436
|
+
*/
|
2437
|
+
observableProto.concatAll = function () {
|
2438
|
+
return this.merge(1);
|
2439
|
+
};
|
2440
|
+
|
2441
|
+
/** @deprecated Use `concatAll` instead. */
|
2442
|
+
observableProto.concatObservable = function () {
|
2443
|
+
deprecate('concatObservable', 'concatAll');
|
2444
|
+
return this.merge(1);
|
2445
|
+
};
|
2244
2446
|
|
2245
2447
|
/**
|
2246
2448
|
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
|
@@ -2287,43 +2489,37 @@
|
|
2287
2489
|
activeCount === 0 && observer.onCompleted();
|
2288
2490
|
}));
|
2289
2491
|
return group;
|
2290
|
-
});
|
2492
|
+
}, sources);
|
2291
2493
|
};
|
2292
2494
|
|
2293
|
-
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
}
|
2316
|
-
if (Array.isArray(sources[0])) {
|
2317
|
-
sources = sources[0];
|
2318
|
-
}
|
2319
|
-
return observableFromArray(sources, scheduler).mergeObservable();
|
2320
|
-
};
|
2495
|
+
/**
|
2496
|
+
* Merges all the observable sequences into a single observable sequence.
|
2497
|
+
* The scheduler is optional and if not specified, the immediate scheduler is used.
|
2498
|
+
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
|
2499
|
+
*/
|
2500
|
+
var observableMerge = Observable.merge = function () {
|
2501
|
+
var scheduler, sources;
|
2502
|
+
if (!arguments[0]) {
|
2503
|
+
scheduler = immediateScheduler;
|
2504
|
+
sources = slice.call(arguments, 1);
|
2505
|
+
} else if (isScheduler(arguments[0])) {
|
2506
|
+
scheduler = arguments[0];
|
2507
|
+
sources = slice.call(arguments, 1);
|
2508
|
+
} else {
|
2509
|
+
scheduler = immediateScheduler;
|
2510
|
+
sources = slice.call(arguments, 0);
|
2511
|
+
}
|
2512
|
+
if (Array.isArray(sources[0])) {
|
2513
|
+
sources = sources[0];
|
2514
|
+
}
|
2515
|
+
return observableOf(scheduler, sources).mergeAll();
|
2516
|
+
};
|
2321
2517
|
|
2322
2518
|
/**
|
2323
2519
|
* Merges an observable sequence of observable sequences into an observable sequence.
|
2324
2520
|
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
|
2325
2521
|
*/
|
2326
|
-
observableProto.
|
2522
|
+
observableProto.mergeAll = function () {
|
2327
2523
|
var sources = this;
|
2328
2524
|
return new AnonymousObservable(function (observer) {
|
2329
2525
|
var group = new CompositeDisposable(),
|
@@ -2347,7 +2543,15 @@
|
|
2347
2543
|
group.length === 1 && observer.onCompleted();
|
2348
2544
|
}));
|
2349
2545
|
return group;
|
2350
|
-
});
|
2546
|
+
}, sources);
|
2547
|
+
};
|
2548
|
+
|
2549
|
+
/**
|
2550
|
+
* @deprecated use #mergeAll instead.
|
2551
|
+
*/
|
2552
|
+
observableProto.mergeObservable = function () {
|
2553
|
+
deprecate('mergeObservable', 'mergeAll');
|
2554
|
+
return this.mergeAll.apply(this, arguments);
|
2351
2555
|
};
|
2352
2556
|
|
2353
2557
|
/**
|
@@ -2377,7 +2581,7 @@
|
|
2377
2581
|
}));
|
2378
2582
|
|
2379
2583
|
return disposables;
|
2380
|
-
});
|
2584
|
+
}, source);
|
2381
2585
|
};
|
2382
2586
|
|
2383
2587
|
/**
|
@@ -2416,7 +2620,7 @@
|
|
2416
2620
|
!hasLatest && observer.onCompleted();
|
2417
2621
|
});
|
2418
2622
|
return new CompositeDisposable(subscription, innerSubscription);
|
2419
|
-
});
|
2623
|
+
}, sources);
|
2420
2624
|
};
|
2421
2625
|
|
2422
2626
|
/**
|
@@ -2432,7 +2636,7 @@
|
|
2432
2636
|
source.subscribe(observer),
|
2433
2637
|
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
|
2434
2638
|
);
|
2435
|
-
});
|
2639
|
+
}, source);
|
2436
2640
|
};
|
2437
2641
|
|
2438
2642
|
function zipArray(second, resultSelector) {
|
@@ -2453,7 +2657,7 @@
|
|
2453
2657
|
observer.onCompleted();
|
2454
2658
|
}
|
2455
2659
|
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
2456
|
-
});
|
2660
|
+
}, first);
|
2457
2661
|
}
|
2458
2662
|
|
2459
2663
|
/**
|
@@ -2515,7 +2719,7 @@
|
|
2515
2719
|
}
|
2516
2720
|
|
2517
2721
|
return new CompositeDisposable(subscriptions);
|
2518
|
-
});
|
2722
|
+
}, parent);
|
2519
2723
|
};
|
2520
2724
|
|
2521
2725
|
/**
|
@@ -2585,63 +2789,61 @@
|
|
2585
2789
|
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
|
2586
2790
|
*/
|
2587
2791
|
observableProto.asObservable = function () {
|
2588
|
-
return new AnonymousObservable(this.subscribe.bind(this));
|
2792
|
+
return new AnonymousObservable(this.subscribe.bind(this), this);
|
2589
2793
|
};
|
2590
2794
|
|
2591
|
-
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2601
|
-
});
|
2602
|
-
};
|
2795
|
+
/**
|
2796
|
+
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
|
2797
|
+
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
|
2798
|
+
*/
|
2799
|
+
observableProto.dematerialize = function () {
|
2800
|
+
var source = this;
|
2801
|
+
return new AnonymousObservable(function (observer) {
|
2802
|
+
return source.subscribe(function (x) { return x.accept(observer); }, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
2803
|
+
}, this);
|
2804
|
+
};
|
2603
2805
|
|
2604
|
-
|
2605
|
-
|
2606
|
-
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2614
|
-
|
2615
|
-
|
2616
|
-
|
2617
|
-
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
|
2636
|
-
|
2637
|
-
|
2638
|
-
|
2639
|
-
|
2640
|
-
|
2641
|
-
|
2642
|
-
|
2643
|
-
|
2644
|
-
|
2806
|
+
/**
|
2807
|
+
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
|
2808
|
+
*
|
2809
|
+
* var obs = observable.distinctUntilChanged();
|
2810
|
+
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
|
2811
|
+
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
|
2812
|
+
*
|
2813
|
+
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
|
2814
|
+
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
|
2815
|
+
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
|
2816
|
+
*/
|
2817
|
+
observableProto.distinctUntilChanged = function (keySelector, comparer) {
|
2818
|
+
var source = this;
|
2819
|
+
keySelector || (keySelector = identity);
|
2820
|
+
comparer || (comparer = defaultComparer);
|
2821
|
+
return new AnonymousObservable(function (observer) {
|
2822
|
+
var hasCurrentKey = false, currentKey;
|
2823
|
+
return source.subscribe(function (value) {
|
2824
|
+
var comparerEquals = false, key;
|
2825
|
+
try {
|
2826
|
+
key = keySelector(value);
|
2827
|
+
} catch (e) {
|
2828
|
+
observer.onError(e);
|
2829
|
+
return;
|
2830
|
+
}
|
2831
|
+
if (hasCurrentKey) {
|
2832
|
+
try {
|
2833
|
+
comparerEquals = comparer(currentKey, key);
|
2834
|
+
} catch (e) {
|
2835
|
+
observer.onError(e);
|
2836
|
+
return;
|
2837
|
+
}
|
2838
|
+
}
|
2839
|
+
if (!hasCurrentKey || !comparerEquals) {
|
2840
|
+
hasCurrentKey = true;
|
2841
|
+
currentKey = key;
|
2842
|
+
observer.onNext(value);
|
2843
|
+
}
|
2844
|
+
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
2845
|
+
}, this);
|
2846
|
+
};
|
2645
2847
|
|
2646
2848
|
/**
|
2647
2849
|
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
|
@@ -2651,7 +2853,7 @@
|
|
2651
2853
|
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
|
2652
2854
|
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
2653
2855
|
*/
|
2654
|
-
observableProto['do'] = observableProto.
|
2856
|
+
observableProto['do'] = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
|
2655
2857
|
var source = this, onNextFunc;
|
2656
2858
|
if (typeof observerOrOnNext === 'function') {
|
2657
2859
|
onNextFunc = observerOrOnNext;
|
@@ -2687,7 +2889,13 @@
|
|
2687
2889
|
}
|
2688
2890
|
observer.onCompleted();
|
2689
2891
|
});
|
2690
|
-
});
|
2892
|
+
}, this);
|
2893
|
+
};
|
2894
|
+
|
2895
|
+
/** @deprecated use #do or #tap instead. */
|
2896
|
+
observableProto.doAction = function () {
|
2897
|
+
deprecate('doAction', 'do or tap');
|
2898
|
+
return this.tap.apply(this, arguments);
|
2691
2899
|
};
|
2692
2900
|
|
2693
2901
|
/**
|
@@ -2725,13 +2933,10 @@
|
|
2725
2933
|
|
2726
2934
|
/**
|
2727
2935
|
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
|
2728
|
-
*
|
2729
|
-
* @example
|
2730
|
-
* var res = observable.finallyAction(function () { console.log('sequence ended'; });
|
2731
2936
|
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
|
2732
2937
|
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
|
2733
2938
|
*/
|
2734
|
-
observableProto['finally'] = observableProto.
|
2939
|
+
observableProto['finally'] = observableProto.ensure = function (action) {
|
2735
2940
|
var source = this;
|
2736
2941
|
return new AnonymousObservable(function (observer) {
|
2737
2942
|
var subscription;
|
@@ -2750,7 +2955,15 @@
|
|
2750
2955
|
action();
|
2751
2956
|
}
|
2752
2957
|
});
|
2753
|
-
});
|
2958
|
+
}, this);
|
2959
|
+
};
|
2960
|
+
|
2961
|
+
/**
|
2962
|
+
* @deprecated use #finally or #ensure instead.
|
2963
|
+
*/
|
2964
|
+
observableProto.finallyAction = function (action) {
|
2965
|
+
deprecate('finallyAction', 'finally or ensure');
|
2966
|
+
return this.ensure(action);
|
2754
2967
|
};
|
2755
2968
|
|
2756
2969
|
/**
|
@@ -2761,7 +2974,7 @@
|
|
2761
2974
|
var source = this;
|
2762
2975
|
return new AnonymousObservable(function (observer) {
|
2763
2976
|
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
2764
|
-
});
|
2977
|
+
}, source);
|
2765
2978
|
};
|
2766
2979
|
|
2767
2980
|
/**
|
@@ -2780,21 +2993,17 @@
|
|
2780
2993
|
observer.onNext(notificationCreateOnCompleted());
|
2781
2994
|
observer.onCompleted();
|
2782
2995
|
});
|
2783
|
-
});
|
2996
|
+
}, source);
|
2784
2997
|
};
|
2785
2998
|
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
2789
|
-
|
2790
|
-
|
2791
|
-
|
2792
|
-
|
2793
|
-
|
2794
|
-
*/
|
2795
|
-
observableProto.repeat = function (repeatCount) {
|
2796
|
-
return enumerableRepeat(this, repeatCount).concat();
|
2797
|
-
};
|
2999
|
+
/**
|
3000
|
+
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
|
3001
|
+
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
|
3002
|
+
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
|
3003
|
+
*/
|
3004
|
+
observableProto.repeat = function (repeatCount) {
|
3005
|
+
return enumerableRepeat(this, repeatCount).concat();
|
3006
|
+
};
|
2798
3007
|
|
2799
3008
|
/**
|
2800
3009
|
* 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.
|
@@ -2807,7 +3016,7 @@
|
|
2807
3016
|
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
|
2808
3017
|
*/
|
2809
3018
|
observableProto.retry = function (retryCount) {
|
2810
|
-
return enumerableRepeat(this, retryCount).
|
3019
|
+
return enumerableRepeat(this, retryCount).catchError();
|
2811
3020
|
};
|
2812
3021
|
|
2813
3022
|
/**
|
@@ -2854,7 +3063,7 @@
|
|
2854
3063
|
observer.onCompleted();
|
2855
3064
|
}
|
2856
3065
|
);
|
2857
|
-
});
|
3066
|
+
}, source);
|
2858
3067
|
};
|
2859
3068
|
|
2860
3069
|
/**
|
@@ -2873,7 +3082,7 @@
|
|
2873
3082
|
q.push(x);
|
2874
3083
|
q.length > count && observer.onNext(q.shift());
|
2875
3084
|
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
2876
|
-
});
|
3085
|
+
}, source);
|
2877
3086
|
};
|
2878
3087
|
|
2879
3088
|
/**
|
@@ -2912,17 +3121,17 @@
|
|
2912
3121
|
q.push(x);
|
2913
3122
|
q.length > count && q.shift();
|
2914
3123
|
}, observer.onError.bind(observer), function () {
|
2915
|
-
while(q.length > 0) { observer.onNext(q.shift()); }
|
3124
|
+
while (q.length > 0) { observer.onNext(q.shift()); }
|
2916
3125
|
observer.onCompleted();
|
2917
3126
|
});
|
2918
|
-
});
|
3127
|
+
}, source);
|
2919
3128
|
};
|
2920
3129
|
|
2921
3130
|
function concatMap(source, selector, thisArg) {
|
2922
3131
|
return source.map(function (x, i) {
|
2923
3132
|
var result = selector.call(thisArg, x, i, source);
|
2924
3133
|
isPromise(result) && (result = observableFromPromise(result));
|
2925
|
-
(
|
3134
|
+
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
|
2926
3135
|
return result;
|
2927
3136
|
}).concatAll();
|
2928
3137
|
}
|
@@ -2947,43 +3156,44 @@
|
|
2947
3156
|
* @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.
|
2948
3157
|
*/
|
2949
3158
|
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
|
2950
|
-
if (
|
3159
|
+
if (isFunction(selector) && isFunction(resultSelector)) {
|
2951
3160
|
return this.concatMap(function (x, i) {
|
2952
3161
|
var selectorResult = selector(x, i);
|
2953
3162
|
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
|
2954
|
-
(
|
3163
|
+
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
|
2955
3164
|
|
2956
3165
|
return selectorResult.map(function (y, i2) {
|
2957
3166
|
return resultSelector(x, y, i, i2);
|
2958
3167
|
});
|
2959
3168
|
});
|
2960
3169
|
}
|
2961
|
-
return
|
3170
|
+
return isFunction(selector) ?
|
2962
3171
|
concatMap(this, selector, thisArg) :
|
2963
3172
|
concatMap(this, function () { return selector; });
|
2964
3173
|
};
|
2965
3174
|
|
2966
3175
|
/**
|
2967
|
-
*
|
3176
|
+
* Projects each element of an observable sequence into a new form by incorporating the element's index.
|
2968
3177
|
* @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.
|
2969
3178
|
* @param {Any} [thisArg] Object to use as this when executing callback.
|
2970
3179
|
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
|
2971
3180
|
*/
|
2972
3181
|
observableProto.select = observableProto.map = function (selector, thisArg) {
|
2973
|
-
var
|
3182
|
+
var selectorFn = isFunction(selector) ? selector : function () { return selector; },
|
3183
|
+
source = this;
|
2974
3184
|
return new AnonymousObservable(function (observer) {
|
2975
3185
|
var count = 0;
|
2976
|
-
return
|
3186
|
+
return source.subscribe(function (value) {
|
2977
3187
|
var result;
|
2978
3188
|
try {
|
2979
|
-
result =
|
3189
|
+
result = selectorFn.call(thisArg, value, count++, source);
|
2980
3190
|
} catch (e) {
|
2981
3191
|
observer.onError(e);
|
2982
3192
|
return;
|
2983
3193
|
}
|
2984
3194
|
observer.onNext(result);
|
2985
3195
|
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
2986
|
-
});
|
3196
|
+
}, source);
|
2987
3197
|
};
|
2988
3198
|
|
2989
3199
|
/**
|
@@ -2999,9 +3209,9 @@
|
|
2999
3209
|
return source.map(function (x, i) {
|
3000
3210
|
var result = selector.call(thisArg, x, i, source);
|
3001
3211
|
isPromise(result) && (result = observableFromPromise(result));
|
3002
|
-
(
|
3212
|
+
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
|
3003
3213
|
return result;
|
3004
|
-
}).
|
3214
|
+
}).mergeAll();
|
3005
3215
|
}
|
3006
3216
|
|
3007
3217
|
/**
|
@@ -3024,18 +3234,18 @@
|
|
3024
3234
|
* @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.
|
3025
3235
|
*/
|
3026
3236
|
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
|
3027
|
-
if (
|
3237
|
+
if (isFunction(selector) && isFunction(resultSelector)) {
|
3028
3238
|
return this.flatMap(function (x, i) {
|
3029
3239
|
var selectorResult = selector(x, i);
|
3030
3240
|
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
|
3031
|
-
(
|
3241
|
+
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
|
3032
3242
|
|
3033
3243
|
return selectorResult.map(function (y, i2) {
|
3034
3244
|
return resultSelector(x, y, i, i2);
|
3035
3245
|
});
|
3036
3246
|
}, thisArg);
|
3037
3247
|
}
|
3038
|
-
return
|
3248
|
+
return isFunction(selector) ?
|
3039
3249
|
flatMap(this, selector, thisArg) :
|
3040
3250
|
flatMap(this, function () { return selector; });
|
3041
3251
|
};
|
@@ -3058,18 +3268,18 @@
|
|
3058
3268
|
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
|
3059
3269
|
*/
|
3060
3270
|
observableProto.skip = function (count) {
|
3061
|
-
|
3062
|
-
|
3063
|
-
|
3064
|
-
|
3065
|
-
|
3066
|
-
|
3067
|
-
|
3068
|
-
|
3069
|
-
|
3070
|
-
|
3071
|
-
|
3072
|
-
|
3271
|
+
if (count < 0) { throw new Error(argumentOutOfRange); }
|
3272
|
+
var source = this;
|
3273
|
+
return new AnonymousObservable(function (observer) {
|
3274
|
+
var remaining = count;
|
3275
|
+
return source.subscribe(function (x) {
|
3276
|
+
if (remaining <= 0) {
|
3277
|
+
observer.onNext(x);
|
3278
|
+
} else {
|
3279
|
+
remaining--;
|
3280
|
+
}
|
3281
|
+
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3282
|
+
}, source);
|
3073
3283
|
};
|
3074
3284
|
|
3075
3285
|
/**
|
@@ -3097,7 +3307,7 @@
|
|
3097
3307
|
}
|
3098
3308
|
running && observer.onNext(x);
|
3099
3309
|
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3100
|
-
});
|
3310
|
+
}, source);
|
3101
3311
|
};
|
3102
3312
|
|
3103
3313
|
/**
|
@@ -3110,18 +3320,18 @@
|
|
3110
3320
|
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
|
3111
3321
|
*/
|
3112
3322
|
observableProto.take = function (count, scheduler) {
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3120
|
-
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
|
3323
|
+
if (count < 0) { throw new RangeError(argumentOutOfRange); }
|
3324
|
+
if (count === 0) { return observableEmpty(scheduler); }
|
3325
|
+
var source = this;
|
3326
|
+
return new AnonymousObservable(function (observer) {
|
3327
|
+
var remaining = count;
|
3328
|
+
return source.subscribe(function (x) {
|
3329
|
+
if (remaining-- > 0) {
|
3330
|
+
observer.onNext(x);
|
3331
|
+
remaining === 0 && observer.onCompleted();
|
3332
|
+
}
|
3333
|
+
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3334
|
+
}, source);
|
3125
3335
|
};
|
3126
3336
|
|
3127
3337
|
/**
|
@@ -3132,13 +3342,13 @@
|
|
3132
3342
|
* @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.
|
3133
3343
|
*/
|
3134
3344
|
observableProto.takeWhile = function (predicate, thisArg) {
|
3135
|
-
var
|
3345
|
+
var source = this;
|
3136
3346
|
return new AnonymousObservable(function (observer) {
|
3137
3347
|
var i = 0, running = true;
|
3138
|
-
return
|
3348
|
+
return source.subscribe(function (x) {
|
3139
3349
|
if (running) {
|
3140
3350
|
try {
|
3141
|
-
running = predicate.call(thisArg, x, i++,
|
3351
|
+
running = predicate.call(thisArg, x, i++, source);
|
3142
3352
|
} catch (e) {
|
3143
3353
|
observer.onError(e);
|
3144
3354
|
return;
|
@@ -3150,7 +3360,7 @@
|
|
3150
3360
|
}
|
3151
3361
|
}
|
3152
3362
|
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3153
|
-
});
|
3363
|
+
}, source);
|
3154
3364
|
};
|
3155
3365
|
|
3156
3366
|
/**
|
@@ -3164,20 +3374,20 @@
|
|
3164
3374
|
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
|
3165
3375
|
*/
|
3166
3376
|
observableProto.where = observableProto.filter = function (predicate, thisArg) {
|
3167
|
-
|
3168
|
-
|
3169
|
-
|
3170
|
-
|
3171
|
-
|
3172
|
-
|
3173
|
-
|
3174
|
-
|
3175
|
-
|
3176
|
-
|
3177
|
-
|
3178
|
-
|
3179
|
-
|
3180
|
-
|
3377
|
+
var source = this;
|
3378
|
+
return new AnonymousObservable(function (observer) {
|
3379
|
+
var count = 0;
|
3380
|
+
return source.subscribe(function (value) {
|
3381
|
+
var shouldRun;
|
3382
|
+
try {
|
3383
|
+
shouldRun = predicate.call(thisArg, value, count++, parent);
|
3384
|
+
} catch (e) {
|
3385
|
+
observer.onError(e);
|
3386
|
+
return;
|
3387
|
+
}
|
3388
|
+
shouldRun && observer.onNext(value);
|
3389
|
+
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
3390
|
+
}, source);
|
3181
3391
|
};
|
3182
3392
|
|
3183
3393
|
/**
|
@@ -3193,12 +3403,12 @@
|
|
3193
3403
|
var args = slice.call(arguments, 0);
|
3194
3404
|
|
3195
3405
|
return new AnonymousObservable(function (observer) {
|
3196
|
-
function handler(
|
3197
|
-
var results =
|
3406
|
+
function handler() {
|
3407
|
+
var results = arguments;
|
3198
3408
|
|
3199
3409
|
if (selector) {
|
3200
3410
|
try {
|
3201
|
-
results = selector(
|
3411
|
+
results = selector(results);
|
3202
3412
|
} catch (err) {
|
3203
3413
|
observer.onError(err);
|
3204
3414
|
return;
|
@@ -3415,10 +3625,8 @@
|
|
3415
3625
|
|
3416
3626
|
promise.then(
|
3417
3627
|
function (value) {
|
3418
|
-
|
3419
|
-
|
3420
|
-
subject.onCompleted();
|
3421
|
-
}
|
3628
|
+
subject.onNext(value);
|
3629
|
+
subject.onCompleted();
|
3422
3630
|
},
|
3423
3631
|
subject.onError.bind(subject));
|
3424
3632
|
|
@@ -3491,7 +3699,7 @@
|
|
3491
3699
|
new AnonymousObservable(function (observer) {
|
3492
3700
|
var connectable = source.multicast(subjectOrSubjectSelector());
|
3493
3701
|
return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
|
3494
|
-
}) :
|
3702
|
+
}, source) :
|
3495
3703
|
new ConnectableObservable(source, subjectOrSubjectSelector);
|
3496
3704
|
};
|
3497
3705
|
|
@@ -3515,10 +3723,6 @@
|
|
3515
3723
|
/**
|
3516
3724
|
* Returns an observable sequence that shares a single subscription to the underlying sequence.
|
3517
3725
|
* This operator is a specialization of publish which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
|
3518
|
-
*
|
3519
|
-
* @example
|
3520
|
-
* var res = source.share();
|
3521
|
-
*
|
3522
3726
|
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
|
3523
3727
|
*/
|
3524
3728
|
observableProto.share = function () {
|
@@ -3565,10 +3769,6 @@
|
|
3565
3769
|
/**
|
3566
3770
|
* Returns an observable sequence that shares a single subscription to the underlying sequence and starts with an initialValue.
|
3567
3771
|
* This operator is a specialization of publishValue which creates a subscription when the number of observers goes from zero to one, then shares that subscription with all subsequent observers until the number of observers returns to zero, at which point the subscription is disposed.
|
3568
|
-
*
|
3569
|
-
* @example
|
3570
|
-
* var res = source.shareValue(42);
|
3571
|
-
*
|
3572
3772
|
* @param {Mixed} initialValue Initial value received by observers upon subscription.
|
3573
3773
|
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
|
3574
3774
|
*/
|
@@ -3803,7 +4003,7 @@
|
|
3803
4003
|
}
|
3804
4004
|
});
|
3805
4005
|
return new CompositeDisposable(subscription, cancelable);
|
3806
|
-
});
|
4006
|
+
}, source);
|
3807
4007
|
}
|
3808
4008
|
|
3809
4009
|
function observableDelayDate(source, dueTime, scheduler) {
|
@@ -3835,16 +4035,11 @@
|
|
3835
4035
|
|
3836
4036
|
/**
|
3837
4037
|
* Ignores values from an observable sequence which are followed by another value before dueTime.
|
3838
|
-
*
|
3839
|
-
* @
|
3840
|
-
*
|
3841
|
-
* 2 - res = source.throttle(5000, scheduler);
|
3842
|
-
*
|
3843
|
-
* @param {Number} dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds).
|
3844
|
-
* @param {Scheduler} [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
|
3845
|
-
* @returns {Observable} The throttled sequence.
|
4038
|
+
* @param {Number} dueTime Duration of the debounce period for each value (specified as an integer denoting milliseconds).
|
4039
|
+
* @param {Scheduler} [scheduler] Scheduler to run the debounce timers on. If not specified, the timeout scheduler is used.
|
4040
|
+
* @returns {Observable} The debounced sequence.
|
3846
4041
|
*/
|
3847
|
-
observableProto.
|
4042
|
+
observableProto.debounce = observableProto.throttleWithTimeout = function (dueTime, scheduler) {
|
3848
4043
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
3849
4044
|
var source = this;
|
3850
4045
|
return new AnonymousObservable(function (observer) {
|
@@ -3876,7 +4071,15 @@
|
|
3876
4071
|
id++;
|
3877
4072
|
});
|
3878
4073
|
return new CompositeDisposable(subscription, cancelable);
|
3879
|
-
});
|
4074
|
+
}, this);
|
4075
|
+
};
|
4076
|
+
|
4077
|
+
/**
|
4078
|
+
* @deprecated use #debounce or #throttleWithTimeout instead.
|
4079
|
+
*/
|
4080
|
+
observableProto.throttle = function(dueTime, scheduler) {
|
4081
|
+
deprecate('throttle', 'debounce or throttleWithTimeout');
|
4082
|
+
return this.debounce(dueTime, scheduler);
|
3880
4083
|
};
|
3881
4084
|
|
3882
4085
|
/**
|
@@ -3897,7 +4100,6 @@
|
|
3897
4100
|
};
|
3898
4101
|
|
3899
4102
|
function sampleObservable(source, sampler) {
|
3900
|
-
|
3901
4103
|
return new AnonymousObservable(function (observer) {
|
3902
4104
|
var atEnd, value, hasValue;
|
3903
4105
|
|
@@ -3918,7 +4120,7 @@
|
|
3918
4120
|
}),
|
3919
4121
|
sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe)
|
3920
4122
|
);
|
3921
|
-
});
|
4123
|
+
}, source);
|
3922
4124
|
}
|
3923
4125
|
|
3924
4126
|
/**
|
@@ -3933,7 +4135,7 @@
|
|
3933
4135
|
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
|
3934
4136
|
* @returns {Observable} Sampled observable sequence.
|
3935
4137
|
*/
|
3936
|
-
observableProto.sample = function (intervalOrSampler, scheduler) {
|
4138
|
+
observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) {
|
3937
4139
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
3938
4140
|
return typeof intervalOrSampler === 'number' ?
|
3939
4141
|
sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :
|
@@ -3994,7 +4196,34 @@
|
|
3994
4196
|
}
|
3995
4197
|
}));
|
3996
4198
|
return new CompositeDisposable(subscription, timer);
|
3997
|
-
});
|
4199
|
+
}, source);
|
4200
|
+
};
|
4201
|
+
|
4202
|
+
/**
|
4203
|
+
* Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
|
4204
|
+
* @param {Number} windowDuration time to wait before emitting another item after emitting the last item
|
4205
|
+
* @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.
|
4206
|
+
* @returns {Observable} An Observable that performs the throttle operation.
|
4207
|
+
*/
|
4208
|
+
observableProto.throttleFirst = function (windowDuration, scheduler) {
|
4209
|
+
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
4210
|
+
var duration = +windowDuration || 0;
|
4211
|
+
if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); }
|
4212
|
+
var source = this;
|
4213
|
+
return new AnonymousObservable(function (observer) {
|
4214
|
+
var lastOnNext = 0;
|
4215
|
+
return source.subscribe(
|
4216
|
+
function (x) {
|
4217
|
+
var now = scheduler.now();
|
4218
|
+
if (lastOnNext === 0 || now - lastOnNext >= duration) {
|
4219
|
+
lastOnNext = now;
|
4220
|
+
observer.onNext(x);
|
4221
|
+
}
|
4222
|
+
},
|
4223
|
+
observer.onError.bind(observer),
|
4224
|
+
observer.onCompleted.bind(observer)
|
4225
|
+
);
|
4226
|
+
}, source);
|
3998
4227
|
};
|
3999
4228
|
|
4000
4229
|
var PausableObservable = (function (_super) {
|
@@ -4057,17 +4286,22 @@
|
|
4057
4286
|
|
4058
4287
|
function combineLatestSource(source, subject, resultSelector) {
|
4059
4288
|
return new AnonymousObservable(function (observer) {
|
4060
|
-
var
|
4061
|
-
hasValue = [false, false],
|
4289
|
+
var hasValue = [false, false],
|
4062
4290
|
hasValueAll = false,
|
4063
4291
|
isDone = false,
|
4064
|
-
values = new Array(
|
4292
|
+
values = new Array(2),
|
4293
|
+
err;
|
4065
4294
|
|
4066
4295
|
function next(x, i) {
|
4067
4296
|
values[i] = x
|
4068
4297
|
var res;
|
4069
4298
|
hasValue[i] = true;
|
4070
4299
|
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
|
4300
|
+
if (err) {
|
4301
|
+
observer.onError(err);
|
4302
|
+
return;
|
4303
|
+
}
|
4304
|
+
|
4071
4305
|
try {
|
4072
4306
|
res = resultSelector.apply(null, values);
|
4073
4307
|
} catch (ex) {
|
@@ -4075,7 +4309,8 @@
|
|
4075
4309
|
return;
|
4076
4310
|
}
|
4077
4311
|
observer.onNext(res);
|
4078
|
-
}
|
4312
|
+
}
|
4313
|
+
if (isDone && values[1]) {
|
4079
4314
|
observer.onCompleted();
|
4080
4315
|
}
|
4081
4316
|
}
|
@@ -4085,23 +4320,33 @@
|
|
4085
4320
|
function (x) {
|
4086
4321
|
next(x, 0);
|
4087
4322
|
},
|
4088
|
-
|
4323
|
+
function (e) {
|
4324
|
+
if (values[1]) {
|
4325
|
+
observer.onError(e);
|
4326
|
+
} else {
|
4327
|
+
err = e;
|
4328
|
+
}
|
4329
|
+
},
|
4089
4330
|
function () {
|
4090
4331
|
isDone = true;
|
4091
|
-
observer.onCompleted();
|
4332
|
+
values[1] && observer.onCompleted();
|
4092
4333
|
}),
|
4093
4334
|
subject.subscribe(
|
4094
4335
|
function (x) {
|
4095
4336
|
next(x, 1);
|
4096
4337
|
},
|
4097
|
-
observer.onError.bind(observer)
|
4338
|
+
observer.onError.bind(observer),
|
4339
|
+
function () {
|
4340
|
+
isDone = true;
|
4341
|
+
next(true, 1);
|
4342
|
+
})
|
4098
4343
|
);
|
4099
4344
|
});
|
4100
4345
|
}
|
4101
4346
|
|
4102
|
-
var PausableBufferedObservable = (function (
|
4347
|
+
var PausableBufferedObservable = (function (__super__) {
|
4103
4348
|
|
4104
|
-
inherits(PausableBufferedObservable,
|
4349
|
+
inherits(PausableBufferedObservable, __super__);
|
4105
4350
|
|
4106
4351
|
function subscribe(observer) {
|
4107
4352
|
var q = [], previousShouldFire;
|
@@ -4161,7 +4406,7 @@
|
|
4161
4406
|
this.pauser = this.controller;
|
4162
4407
|
}
|
4163
4408
|
|
4164
|
-
|
4409
|
+
__super__.call(this, subscribe);
|
4165
4410
|
}
|
4166
4411
|
|
4167
4412
|
PausableBufferedObservable.prototype.pause = function () {
|
@@ -4353,7 +4598,7 @@
|
|
4353
4598
|
}(Observable));
|
4354
4599
|
|
4355
4600
|
/**
|
4356
|
-
* Executes a transducer to transform the observable sequence
|
4601
|
+
* Executes a transducer to transform the observable sequence
|
4357
4602
|
* @param {Transducer} transducer A transducer to execute
|
4358
4603
|
* @returns {Observable} An Observable sequence containing the results from the transducer.
|
4359
4604
|
*/
|
@@ -4377,17 +4622,17 @@
|
|
4377
4622
|
return new AnonymousObservable(function(observer) {
|
4378
4623
|
var xform = transducer(transformForObserver(observer));
|
4379
4624
|
return source.subscribe(
|
4380
|
-
function(v) {
|
4625
|
+
function(v) {
|
4381
4626
|
try {
|
4382
4627
|
xform.step(observer, v);
|
4383
4628
|
} catch (e) {
|
4384
4629
|
observer.onError(e);
|
4385
4630
|
}
|
4386
|
-
},
|
4387
|
-
observer.onError.bind(observer),
|
4631
|
+
},
|
4632
|
+
observer.onError.bind(observer),
|
4388
4633
|
function() { xform.result(observer); }
|
4389
4634
|
);
|
4390
|
-
});
|
4635
|
+
}, source);
|
4391
4636
|
};
|
4392
4637
|
|
4393
4638
|
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
|
@@ -4402,7 +4647,8 @@
|
|
4402
4647
|
disposableEmpty;
|
4403
4648
|
}
|
4404
4649
|
|
4405
|
-
function AnonymousObservable(subscribe) {
|
4650
|
+
function AnonymousObservable(subscribe, parent) {
|
4651
|
+
this.source = parent;
|
4406
4652
|
if (!(this instanceof AnonymousObservable)) {
|
4407
4653
|
return new AnonymousObservable(subscribe);
|
4408
4654
|
}
|
@@ -4435,66 +4681,59 @@
|
|
4435
4681
|
|
4436
4682
|
}(Observable));
|
4437
4683
|
|
4438
|
-
|
4439
|
-
|
4440
|
-
inherits(AutoDetachObserver, _super);
|
4684
|
+
var AutoDetachObserver = (function (__super__) {
|
4685
|
+
inherits(AutoDetachObserver, __super__);
|
4441
4686
|
|
4442
|
-
|
4443
|
-
|
4444
|
-
|
4445
|
-
|
4446
|
-
|
4687
|
+
function AutoDetachObserver(observer) {
|
4688
|
+
__super__.call(this);
|
4689
|
+
this.observer = observer;
|
4690
|
+
this.m = new SingleAssignmentDisposable();
|
4691
|
+
}
|
4447
4692
|
|
4448
|
-
|
4693
|
+
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
|
4449
4694
|
|
4450
|
-
|
4451
|
-
|
4452
|
-
|
4453
|
-
|
4454
|
-
|
4455
|
-
|
4456
|
-
|
4457
|
-
|
4458
|
-
|
4459
|
-
|
4460
|
-
|
4461
|
-
}
|
4462
|
-
};
|
4695
|
+
AutoDetachObserverPrototype.next = function (value) {
|
4696
|
+
var noError = false;
|
4697
|
+
try {
|
4698
|
+
this.observer.onNext(value);
|
4699
|
+
noError = true;
|
4700
|
+
} catch (e) {
|
4701
|
+
throw e;
|
4702
|
+
} finally {
|
4703
|
+
!noError && this.dispose();
|
4704
|
+
}
|
4705
|
+
};
|
4463
4706
|
|
4464
|
-
|
4465
|
-
|
4466
|
-
|
4467
|
-
|
4468
|
-
|
4469
|
-
|
4470
|
-
|
4471
|
-
|
4472
|
-
|
4707
|
+
AutoDetachObserverPrototype.error = function (err) {
|
4708
|
+
try {
|
4709
|
+
this.observer.onError(err);
|
4710
|
+
} catch (e) {
|
4711
|
+
throw e;
|
4712
|
+
} finally {
|
4713
|
+
this.dispose();
|
4714
|
+
}
|
4715
|
+
};
|
4473
4716
|
|
4474
|
-
|
4475
|
-
|
4476
|
-
|
4477
|
-
|
4478
|
-
|
4479
|
-
|
4480
|
-
|
4481
|
-
|
4482
|
-
|
4717
|
+
AutoDetachObserverPrototype.completed = function () {
|
4718
|
+
try {
|
4719
|
+
this.observer.onCompleted();
|
4720
|
+
} catch (e) {
|
4721
|
+
throw e;
|
4722
|
+
} finally {
|
4723
|
+
this.dispose();
|
4724
|
+
}
|
4725
|
+
};
|
4483
4726
|
|
4484
|
-
|
4485
|
-
|
4486
|
-
/* @private */
|
4487
|
-
AutoDetachObserverPrototype.disposable = function (value) {
|
4488
|
-
return arguments.length ? this.getDisposable() : setDisposable(value);
|
4489
|
-
};
|
4727
|
+
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
|
4728
|
+
AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); };
|
4490
4729
|
|
4491
|
-
|
4492
|
-
|
4493
|
-
|
4494
|
-
|
4730
|
+
AutoDetachObserverPrototype.dispose = function () {
|
4731
|
+
__super__.prototype.dispose.call(this);
|
4732
|
+
this.m.dispose();
|
4733
|
+
};
|
4495
4734
|
|
4496
|
-
|
4497
|
-
|
4735
|
+
return AutoDetachObserver;
|
4736
|
+
}(AbstractObserver));
|
4498
4737
|
|
4499
4738
|
/** @private */
|
4500
4739
|
var InnerSubscription = function (subject, observer) {
|
@@ -4890,21 +5129,17 @@
|
|
4890
5129
|
this._trim(this.scheduler.now());
|
4891
5130
|
this.observers.push(so);
|
4892
5131
|
|
4893
|
-
var n = this.q.length;
|
4894
|
-
|
4895
5132
|
for (var i = 0, len = this.q.length; i < len; i++) {
|
4896
5133
|
so.onNext(this.q[i].value);
|
4897
5134
|
}
|
4898
5135
|
|
4899
5136
|
if (this.hasError) {
|
4900
|
-
n++;
|
4901
5137
|
so.onError(this.error);
|
4902
5138
|
} else if (this.isStopped) {
|
4903
|
-
n++;
|
4904
5139
|
so.onCompleted();
|
4905
5140
|
}
|
4906
5141
|
|
4907
|
-
so.ensureActive(
|
5142
|
+
so.ensureActive();
|
4908
5143
|
return subscription;
|
4909
5144
|
}
|
4910
5145
|
|
@@ -5030,4 +5265,7 @@
|
|
5030
5265
|
root.Rx = Rx;
|
5031
5266
|
}
|
5032
5267
|
|
5268
|
+
// All code before this point will be filtered from stack traces.
|
5269
|
+
var rEndingLine = captureLine();
|
5270
|
+
|
5033
5271
|
}.call(this));
|