rxjs-rails 2.5.2 → 3.1.0
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 +367 -284
- data/vendor/assets/javascripts/rx.aggregates.map +1 -1
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.all.compat.js +2405 -2438
- data/vendor/assets/javascripts/rx.all.compat.map +1 -1
- data/vendor/assets/javascripts/rx.all.compat.min.js +4 -4
- data/vendor/assets/javascripts/rx.all.js +2380 -2395
- data/vendor/assets/javascripts/rx.all.map +1 -1
- data/vendor/assets/javascripts/rx.all.min.js +4 -4
- data/vendor/assets/javascripts/rx.async.compat.js +311 -333
- data/vendor/assets/javascripts/rx.async.compat.map +1 -1
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +280 -327
- data/vendor/assets/javascripts/rx.async.map +1 -1
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.backpressure.js +208 -176
- data/vendor/assets/javascripts/rx.backpressure.map +1 -1
- data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
- data/vendor/assets/javascripts/rx.binding.js +44 -27
- data/vendor/assets/javascripts/rx.binding.map +1 -1
- data/vendor/assets/javascripts/rx.binding.min.js +1 -1
- data/vendor/assets/javascripts/rx.coincidence.js +220 -453
- data/vendor/assets/javascripts/rx.coincidence.map +1 -1
- data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +1366 -1173
- data/vendor/assets/javascripts/rx.compat.map +1 -1
- data/vendor/assets/javascripts/rx.compat.min.js +3 -2
- data/vendor/assets/javascripts/rx.core.binding.js +823 -0
- data/vendor/assets/javascripts/rx.core.binding.map +1 -0
- data/vendor/assets/javascripts/rx.core.binding.min.js +3 -0
- data/vendor/assets/javascripts/rx.core.js +1281 -0
- data/vendor/assets/javascripts/rx.core.map +1 -0
- data/vendor/assets/javascripts/rx.core.min.js +3 -0
- data/vendor/assets/javascripts/rx.core.testing.js +1242 -0
- data/vendor/assets/javascripts/rx.core.testing.map +1 -0
- data/vendor/assets/javascripts/rx.core.testing.min.js +3 -0
- data/vendor/assets/javascripts/rx.experimental.js +85 -123
- data/vendor/assets/javascripts/rx.experimental.map +1 -1
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
- data/vendor/assets/javascripts/rx.joinpatterns.js +48 -37
- data/vendor/assets/javascripts/rx.joinpatterns.map +1 -1
- data/vendor/assets/javascripts/rx.joinpatterns.min.js +1 -1
- data/vendor/assets/javascripts/rx.js +1367 -1174
- data/vendor/assets/javascripts/rx.lite.compat.js +1621 -1403
- data/vendor/assets/javascripts/rx.lite.compat.map +1 -1
- data/vendor/assets/javascripts/rx.lite.compat.min.js +3 -3
- data/vendor/assets/javascripts/rx.lite.extras.compat.js +119 -89
- data/vendor/assets/javascripts/rx.lite.extras.compat.map +1 -1
- data/vendor/assets/javascripts/rx.lite.extras.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.lite.extras.js +119 -89
- data/vendor/assets/javascripts/rx.lite.extras.map +1 -1
- data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
- data/vendor/assets/javascripts/rx.lite.js +1583 -1390
- data/vendor/assets/javascripts/rx.lite.map +1 -1
- data/vendor/assets/javascripts/rx.lite.min.js +3 -3
- data/vendor/assets/javascripts/rx.map +1 -1
- data/vendor/assets/javascripts/rx.min.js +3 -2
- data/vendor/assets/javascripts/rx.sorting.js +23 -27
- data/vendor/assets/javascripts/rx.sorting.map +1 -1
- data/vendor/assets/javascripts/rx.sorting.min.js +1 -1
- data/vendor/assets/javascripts/rx.testing.js +11 -15
- data/vendor/assets/javascripts/rx.testing.map +1 -1
- data/vendor/assets/javascripts/rx.testing.min.js +1 -1
- data/vendor/assets/javascripts/rx.time.js +117 -133
- data/vendor/assets/javascripts/rx.time.map +1 -1
- data/vendor/assets/javascripts/rx.time.min.js +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.js +120 -39
- data/vendor/assets/javascripts/rx.virtualtime.map +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -1
- metadata +12 -3
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rx.coincidence.min.js","sources":["rx.coincidence.js"],"names":["factory","objectTypes","boolean","function","object","number","string","undefined","root","window","this","freeExports","exports","nodeType","freeModule","module","freeGlobal","global","define","amd","Rx","require","call","exp","observableWindowWithOpenings","windowOpenings","windowClosingSelector","groupJoin","observableEmpty","_","win","observableWindowWithBoundaries","windowBoundaries","source","AnonymousObservable","observer","Subject","d","CompositeDisposable","r","RefCountDisposable","onNext","addRef","add","subscribe","x","err","onError","onCompleted","isPromise","observableFromPromise","observableWindowWithClosingSelector","createWindowClose","windowClose","e","m1","SingleAssignmentDisposable","m","setDisposable","take","noop","SerialDisposable","Observable","observableProto","prototype","empty","observableNever","never","Observer","create","internals","defaultComparer","isEqual","inherits","helpers","identity","fromPromise","ArgumentOutOfRangeError","Dictionary","isPrime","candidate","num1","Math","sqrt","num2","getPrime","min","index","num","primes","length","stringHashFn","str","hash","i","len","character","charCodeAt","numberHashFn","key","c2","newEntry","value","next","hashCode","capacity","comparer","_initialize","freeCount","size","freeList","noSuchkey","duplicatekey","getHashCode","uniqueIdCounter","obj","Error","Date","valueOf","RegExp","toString","id","dictionaryProto","prime","buckets","Array","entries","_insert","index3","index1","index2","_resize","numArray","entryArray","remove","clear","_findEntry","count","tryGetValue","entry","getValues","results","get","set","containskey","join","right","leftDurationSelector","rightDurationSelector","resultSelector","left","group","leftDone","rightDone","leftId","rightId","leftMap","rightMap","md","duration","expire","bind","forEach","v","result","exn","handleError","s","buffer","apply","arguments","selectMany","toArray","windowOpeningsOrClosingSelector","pairwise","previous","hasPrevious","partition","predicate","thisArg","filter","o","groupBy","keySelector","elementSelector","groupByUntil","durationSelector","item","map","groupDisposable","refCountDisposable","fireNewMapEntry","writer","GroupedObservable","durationGroup","element","ex","__super__","underlyingObservable","mergedDisposable","getDisposable"],"mappings":";CAEE,SAAUA,GACR,GAAIC,IACAC,WAAW,EACXC,YAAY,EACZC,QAAU,EACVC,QAAU,EACVC,QAAU,EACVC,WAAa,GAGbC,EAAQP,QAAmBQ,UAAWA,QAAWC,KACjDC,EAAcV,QAAmBW,WAAYA,UAAYA,QAAQC,UAAYD,QAC7EE,EAAab,QAAmBc,UAAWA,SAAWA,OAAOF,UAAYE,OAEzEC,GADgBF,GAAcA,EAAWF,UAAYD,GAAeA,EACvDV,QAAmBgB,UAAWA,SAE3CD,GAAeA,EAAWC,SAAWD,GAAcA,EAAWP,SAAWO,IACzER,EAAOQ,GAIW,kBAAXE,SAAyBA,OAAOC,IACvCD,QAAQ,MAAO,SAAUE,EAAIR,GACzB,MAAOZ,GAAQQ,EAAMI,EAASQ,KAET,gBAAXL,SAAuBA,QAAUA,OAAOH,UAAYD,EAClEI,OAAOH,QAAUZ,EAAQQ,EAAMO,OAAOH,QAASS,QAAQ,SAEvDb,EAAKY,GAAKpB,EAAQQ,KAAUA,EAAKY,MAEvCE,KAAKZ,KAAM,SAAUF,EAAMe,EAAKH,EAAIb,GAigBpC,QAASiB,GAA6BC,EAAgBC,GACpD,MAAOD,GAAeE,UAAUjB,KAAMgB,EAAuBE,EAAiB,SAAUC,EAAGC,GACzF,MAAOA,KAIX,QAASC,GAA+BC,GACtC,GAAIC,GAASvB,IACb,OAAO,IAAIwB,GAAoB,SAAUC,GACvC,GAAIL,GAAM,GAAIM,GACZC,EAAI,GAAIC,GACRC,EAAI,GAAIC,GAAmBH,EA4B7B,OA1BAF,GAASM,OAAOC,EAAOZ,EAAKS,IAE5BF,EAAEM,IAAIV,EAAOW,UAAU,SAAUC,GAC/Bf,EAAIW,OAAOI,IACV,SAAUC,GACXhB,EAAIiB,QAAQD,GACZX,EAASY,QAAQD,IAChB,WACDhB,EAAIkB,cACJb,EAASa,iBAGXC,EAAUjB,KAAsBA,EAAmB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zB,MAAK4L,qBAAqB1J,UAAUT,GAG7C,QAAS8J,GAAkB9F,EAAKmG,EAAsBC,GACpDF,EAAU/K,KAAKZ,KAAMkC,GACrBlC,KAAKyF,IAAMA,EACXzF,KAAK4L,qBAAwBC,EAE3B,GAAIrK,GAAoB,SAAUC,GAChC,MAAO,IAAIG,GAAoBiK,EAAiBC,gBAAiBF,EAAqB1J,UAAUT,MAFlGmK,EAMJ,MAhBA7H,GAASwH,EAAmBI,GAgBrBJ,GACPnI,EAEA,OAAO1C"}
|
1
|
+
{"version":3,"file":"rx.coincidence.min.js","sources":["rx.coincidence.js"],"names":["factory","objectTypes","function","object","freeExports","exports","nodeType","freeSelf","self","Object","freeWindow","window","freeModule","module","freeGlobal","global","root","this","define","amd","Rx","require","call","exp","undefined","tryCatcher","tryCatchTarget","apply","arguments","e","errorObj","tryCatch","fn","isFunction","TypeError","toArray","x","observableWindowWithOpenings","windowOpenings","windowClosingSelector","groupJoin","observableEmpty","_","win","observableWindowWithBoundaries","windowBoundaries","source","AnonymousObservable","observer","Subject","d","CompositeDisposable","r","RefCountDisposable","onNext","addRef","add","subscribe","err","onError","onCompleted","isPromise","observableFromPromise","observableWindowWithClosingSelector","createWindowClose","windowClose","m1","SingleAssignmentDisposable","m","setDisposable","take","noop","SerialDisposable","Observable","observableProto","prototype","empty","observableNever","never","Observer","create","internals","inherits","isEqual","helpers","identity","bindCallback","fromPromise","ArgumentOutOfRangeError","Map","size","_values","_keys","key","i","indexOf","splice","get","set","value","push","forEach","cb","thisArg","join","right","leftDurationSelector","rightDurationSelector","resultSelector","left","o","group","leftDone","rightDone","leftId","rightId","leftMap","rightMap","handleError","id","md","duration","remove","v","result","s","buffer","flatMap","windowOpeningsOrClosingSelector","length","pairwise","previous","hasPrevious","bind","partition","predicate","filter","groupBy","keySelector","elementSelector","groupByUntil","durationSelector","map","groupDisposable","refCountDisposable","item","fireNewMapEntry","writer","GroupedObservable","durationGroup","element","__super__","underlyingObservable","mergedDisposable","getDisposable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AAI1G,GAAoB,SAAUC,GAChC,MAAO,IAAIG,GAAoBsG,EAAiBC,gBAAiBF,EAAqB/F,UAAUT,MAFlGwG,EAMJ,MAhBAtE,GAASkE,EAAmBG,GAgBrBH,GACP3E,EAEF,OAAOrD"}
|
@@ -1,3 +1,3 @@
|
|
1
1
|
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
|
2
|
-
(function(a){var b={"
|
2
|
+
(function(a){var b={"function":!0,object:!0},c=b[typeof exports]&&exports&&!exports.nodeType&&exports,d=b[typeof self]&&self.Object&&self,e=b[typeof window]&&window&&window.Object&&window,f=b[typeof module]&&module&&!module.nodeType&&module,g=(f&&f.exports===c&&c,c&&f&&"object"==typeof global&&global&&global.Object&&global),h=h=g||e!==(this&&this.window)&&e||d||this;"function"==typeof define&&define.amd?define(["./rx"],function(b,c){return a(h,c,b)}):"object"==typeof module&&module&&module.exports===c?module.exports=a(h,module.exports,require("./rx")):h.Rx=a(h,{},h.Rx)}).call(this,function(a,b,c,d){function e(){try{return k.apply(this,arguments)}catch(a){return B.e=a,B}}function f(a){if(!z(a))throw new TypeError("fn must be a function");return k=a,e}function g(a){return a.toArray()}function h(a,b){return a.groupJoin(this,b,s,function(a,b){return b})}function i(a){var b=this;return new u(function(c){var d=new q,e=new m,f=new n(e);return c.onNext(v(d,f)),e.add(b.subscribe(function(a){d.onNext(a)},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),y(a)&&(a=A(a)),e.add(a.subscribe(function(){d.onCompleted(),d=new q,c.onNext(v(d,f))},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),f},b)}function j(a){var b=this;return new u(function(c){function d(){var b;try{b=a()}catch(f){return void c.onError(f)}y(b)&&(b=A(b));var i=new o;e.setDisposable(i),i.setDisposable(b.take(1).subscribe(x,function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),h=new q,c.onNext(v(h,g)),d()}))}var e=new p,f=new m(e),g=new n(f),h=new q;return c.onNext(v(h,g)),f.add(b.subscribe(function(a){h.onNext(a)},function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),c.onCompleted()})),d(),g},b)}var k,l=c.Observable,m=c.CompositeDisposable,n=c.RefCountDisposable,o=c.SingleAssignmentDisposable,p=c.SerialDisposable,q=c.Subject,r=l.prototype,s=l.empty,t=l.never,u=c.AnonymousObservable,v=(c.Observer.create,c.internals.addRef),w=(c.internals.isEqual,c.internals.inherits),x=c.helpers.noop,y=(c.helpers.identity,c.helpers.isPromise),z=c.helpers.isFunction,A=(c.internals.bindCallback,l.fromPromise),B=(c.ArgumentOutOfRangeError,{e:{}}),C=a.Map||function(){function a(){this.size=0,this._values=[],this._keys=[]}return a.prototype["delete"]=function(a){var b=this._keys.indexOf(a);return-1===b?!1:(this._values.splice(b,1),this._keys.splice(b,1),this.size--,!0)},a.prototype.get=function(a){var b=this._keys.indexOf(a);return-1===b?d:this._values[b]},a.prototype.set=function(a,b){var c=this._keys.indexOf(a);return-1===c?(this._keys.push(a),this._values.push(b),this.size++):this._values[c]=b,this},a.prototype.forEach=function(a,b){for(var c=0;c<this.size;c++)a.call(b,this._values[c],this._keys[c])},a}();r.join=function(a,b,c,d){var e=this;return new u(function(g){var h=new m,i=!1,j=!1,k=0,l=0,n=new C,p=new C,q=function(a){g.onError(a)};return h.add(e.subscribe(function(a){var c=k++,e=new o;n.set(c,a),h.add(e);var j=f(b)(a);return j===B?g.onError(j.e):(e.setDisposable(j.take(1).subscribe(x,q,function(){n["delete"](c)&&0===n.size&&i&&g.onCompleted(),h.remove(e)})),void p.forEach(function(b){var c=f(d)(a,b);return c===B?g.onError(c.e):void g.onNext(c)}))},q,function(){i=!0,(j||0===n.size)&&g.onCompleted()})),h.add(a.subscribe(function(a){var b=l++,e=new o;p.set(b,a),h.add(e);var i=f(c)(a);return i===B?g.onError(i.e):(e.setDisposable(i.take(1).subscribe(x,q,function(){p["delete"](b)&&0===p.size&&j&&g.onCompleted(),h.remove(e)})),void n.forEach(function(b){var c=f(d)(b,a);return c===B?g.onError(c.e):void g.onNext(c)}))},q,function(){j=!0,(i||0===p.size)&&g.onCompleted()})),h},e)},r.groupJoin=function(a,b,c,d){var e=this;return new u(function(g){function h(){}var i=new m,j=new n(i),k=new C,l=new C,p=0,r=0,h=function(a){return function(b){b.onError(a)}};return i.add(e.subscribe(function(a){var c=new q,e=p++;k.set(e,c);var m=f(d)(a,v(c,j));if(m===B)return k.forEach(h(m.e)),g.onError(m.e);g.onNext(m),l.forEach(function(a){c.onNext(a)});var n=new o;i.add(n);var r=f(b)(a);return r===B?(k.forEach(h(r.e)),g.onError(r.e)):void n.setDisposable(r.take(1).subscribe(x,function(a){k.forEach(h(a)),g.onError(a)},function(){k["delete"](e)&&c.onCompleted(),i.remove(n)}))},function(a){k.forEach(h(a)),g.onError(a)},function(){g.onCompleted()})),i.add(a.subscribe(function(a){var b=r++;l.set(b,a);var d=new o;i.add(d);var e=f(c)(a);return e===B?(k.forEach(h(e.e)),g.onError(e.e)):(d.setDisposable(e.take(1).subscribe(x,function(a){k.forEach(h(a)),g.onError(a)},function(){l["delete"](b),i.remove(d)})),void k.forEach(function(b){b.onNext(a)}))},function(a){k.forEach(h(a)),g.onError(a)})),j},e)},r.buffer=function(){return this.window.apply(this,arguments).flatMap(g)},r.window=function(a,b){return 1===arguments.length&&"function"!=typeof arguments[0]?i.call(this,a):"function"==typeof a?j.call(this,a):h.call(this,a,b)},r.pairwise=function(){var a=this;return new u(function(b){var c,d=!1;return a.subscribe(function(a){d?b.onNext([c,a]):d=!0,c=a},b.onError.bind(b),b.onCompleted.bind(b))},a)},r.partition=function(a,b){return[this.filter(a,b),this.filter(function(c,d,e){return!a.call(b,c,d,e)})]},r.groupBy=function(a,b){return this.groupByUntil(a,b,t)},r.groupByUntil=function(a,b,c){var e=this;return new u(function(g){var h=new C,i=new m,j=new n(i),k=function(a){return function(b){b.onError(a)}};return i.add(e.subscribe(function(e){var l=f(a)(e);if(l===B)return h.forEach(k(l.e)),g.onError(l.e);var m=!1,n=h.get(l);if(n===d&&(n=new q,h.set(l,n),m=!0),m){var p=new D(l,n,j),r=new D(l,n),s=f(c)(r);if(s===B)return h.forEach(k(s.e)),g.onError(s.e);g.onNext(p);var t=new o;i.add(t),t.setDisposable(s.take(1).subscribe(x,function(a){h.forEach(k(a)),g.onError(a)},function(){h["delete"](l)&&n.onCompleted(),i.remove(t)}))}var u=e;return z(b)&&(u=f(b)(e),u===B)?(h.forEach(k(u.e)),g.onError(u.e)):void n.onNext(u)},function(a){h.forEach(k(a)),g.onError(a)},function(){h.forEach(function(a){a.onCompleted()}),g.onCompleted()})),j},e)};var D=function(a){function b(a){return this.underlyingObservable.subscribe(a)}function c(c,d,e){a.call(this,b),this.key=c,this.underlyingObservable=e?new u(function(a){return new m(e.getDisposable(),d.subscribe(a))}):d}return w(c,a),c}(l);return c});
|
3
3
|
//# sourceMappingURL=rx.coincidence.map
|
@@ -3,46 +3,37 @@
|
|
3
3
|
;(function (undefined) {
|
4
4
|
|
5
5
|
var objectTypes = {
|
6
|
-
'boolean': false,
|
7
6
|
'function': true,
|
8
|
-
'object': true
|
9
|
-
'number': false,
|
10
|
-
'string': false,
|
11
|
-
'undefined': false
|
7
|
+
'object': true
|
12
8
|
};
|
13
9
|
|
14
|
-
var
|
10
|
+
var
|
15
11
|
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
|
12
|
+
freeSelf = objectTypes[typeof self] && self.Object && self,
|
13
|
+
freeWindow = objectTypes[typeof window] && window && window.Object && window,
|
16
14
|
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
|
17
15
|
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
|
18
|
-
freeGlobal =
|
16
|
+
freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
|
19
17
|
|
20
|
-
|
21
|
-
root = freeGlobal;
|
22
|
-
}
|
18
|
+
var root = root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
|
23
19
|
|
24
20
|
var Rx = {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
internals: {},
|
22
|
+
config: {
|
23
|
+
Promise: root.Promise
|
24
|
+
},
|
25
|
+
helpers: { }
|
30
26
|
};
|
31
27
|
|
32
28
|
// Defaults
|
33
29
|
var noop = Rx.helpers.noop = function () { },
|
34
|
-
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
|
35
30
|
identity = Rx.helpers.identity = function (x) { return x; },
|
36
|
-
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
|
37
|
-
just = Rx.helpers.just = function (value) { return function () { return value; }; },
|
38
31
|
defaultNow = Rx.helpers.defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()),
|
39
32
|
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
|
40
33
|
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
|
41
34
|
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
|
42
35
|
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
|
43
|
-
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
|
44
|
-
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
|
45
|
-
not = Rx.helpers.not = function (a) { return !a; },
|
36
|
+
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; },
|
46
37
|
isFunction = Rx.helpers.isFunction = (function () {
|
47
38
|
var isFn = function (value) {
|
48
39
|
return typeof value == 'function' || false;
|
@@ -63,45 +54,59 @@
|
|
63
54
|
return a;
|
64
55
|
}
|
65
56
|
|
66
|
-
|
67
|
-
var
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
57
|
+
var errorObj = {e: {}};
|
58
|
+
var tryCatchTarget;
|
59
|
+
function tryCatcher() {
|
60
|
+
try {
|
61
|
+
return tryCatchTarget.apply(this, arguments);
|
62
|
+
} catch (e) {
|
63
|
+
errorObj.e = e;
|
64
|
+
return errorObj;
|
65
|
+
}
|
66
|
+
}
|
67
|
+
function tryCatch(fn) {
|
68
|
+
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
|
69
|
+
tryCatchTarget = fn;
|
70
|
+
return tryCatcher;
|
71
|
+
}
|
72
|
+
function thrower(e) {
|
73
|
+
throw e;
|
72
74
|
}
|
73
75
|
|
76
|
+
Rx.config.longStackSupport = false;
|
77
|
+
var hasStacks = false, stacks = tryCatch(function () { throw new Error(); })();
|
78
|
+
hasStacks = !!stacks.e && !!stacks.e.stack;
|
79
|
+
|
74
80
|
// All code after this point will be filtered from stack traces reported by RxJS
|
75
81
|
var rStartingLine = captureLine(), rFileName;
|
76
82
|
|
77
|
-
var STACK_JUMP_SEPARATOR =
|
83
|
+
var STACK_JUMP_SEPARATOR = 'From previous event:';
|
78
84
|
|
79
85
|
function makeStackTraceLong(error, observable) {
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
}
|
86
|
+
// If possible, transform the error stack trace by removing Node and RxJS
|
87
|
+
// cruft, then concatenating with the stack trace of `observable`.
|
88
|
+
if (hasStacks &&
|
89
|
+
observable.stack &&
|
90
|
+
typeof error === 'object' &&
|
91
|
+
error !== null &&
|
92
|
+
error.stack &&
|
93
|
+
error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
|
94
|
+
) {
|
95
|
+
var stacks = [];
|
96
|
+
for (var o = observable; !!o; o = o.source) {
|
97
|
+
if (o.stack) {
|
98
|
+
stacks.unshift(o.stack);
|
94
99
|
}
|
95
|
-
|
100
|
+
}
|
101
|
+
stacks.unshift(error.stack);
|
96
102
|
|
97
|
-
|
98
|
-
|
103
|
+
var concatedStacks = stacks.join('\n' + STACK_JUMP_SEPARATOR + '\n');
|
104
|
+
error.stack = filterStackString(concatedStacks);
|
99
105
|
}
|
100
106
|
}
|
101
107
|
|
102
108
|
function filterStackString(stackString) {
|
103
|
-
var lines = stackString.split(
|
104
|
-
desiredLines = [];
|
109
|
+
var lines = stackString.split('\n'), desiredLines = [];
|
105
110
|
for (var i = 0, len = lines.length; i < len; i++) {
|
106
111
|
var line = lines[i];
|
107
112
|
|
@@ -109,7 +114,7 @@
|
|
109
114
|
desiredLines.push(line);
|
110
115
|
}
|
111
116
|
}
|
112
|
-
return desiredLines.join(
|
117
|
+
return desiredLines.join('\n');
|
113
118
|
}
|
114
119
|
|
115
120
|
function isInternalFrame(stackLine) {
|
@@ -125,8 +130,8 @@
|
|
125
130
|
}
|
126
131
|
|
127
132
|
function isNodeFrame(stackLine) {
|
128
|
-
return stackLine.indexOf(
|
129
|
-
stackLine.indexOf(
|
133
|
+
return stackLine.indexOf('(module.js:') !== -1 ||
|
134
|
+
stackLine.indexOf('(node.js:') !== -1;
|
130
135
|
}
|
131
136
|
|
132
137
|
function captureLine() {
|
@@ -135,8 +140,8 @@
|
|
135
140
|
try {
|
136
141
|
throw new Error();
|
137
142
|
} catch (e) {
|
138
|
-
var lines = e.stack.split(
|
139
|
-
var firstLine = lines[0].indexOf(
|
143
|
+
var lines = e.stack.split('\n');
|
144
|
+
var firstLine = lines[0].indexOf('@') > 0 ? lines[1] : lines[2];
|
140
145
|
var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
|
141
146
|
if (!fileNameAndLineNumber) { return; }
|
142
147
|
|
@@ -146,45 +151,50 @@
|
|
146
151
|
}
|
147
152
|
|
148
153
|
function getFileNameAndLineNumber(stackLine) {
|
149
|
-
// Named functions:
|
154
|
+
// Named functions: 'at functionName (filename:lineNumber:columnNumber)'
|
150
155
|
var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
|
151
156
|
if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }
|
152
157
|
|
153
|
-
// Anonymous functions:
|
158
|
+
// Anonymous functions: 'at filename:lineNumber:columnNumber'
|
154
159
|
var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
|
155
160
|
if (attempt2) { return [attempt2[1], Number(attempt2[2])]; }
|
156
161
|
|
157
|
-
// Firefox style:
|
162
|
+
// Firefox style: 'function@filename:lineNumber or @filename:lineNumber'
|
158
163
|
var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
|
159
164
|
if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }
|
160
165
|
}
|
161
166
|
|
162
167
|
var EmptyError = Rx.EmptyError = function() {
|
163
168
|
this.message = 'Sequence contains no elements.';
|
169
|
+
this.name = 'EmptyError';
|
164
170
|
Error.call(this);
|
165
171
|
};
|
166
172
|
EmptyError.prototype = Error.prototype;
|
167
173
|
|
168
174
|
var ObjectDisposedError = Rx.ObjectDisposedError = function() {
|
169
175
|
this.message = 'Object has been disposed';
|
176
|
+
this.name = 'ObjectDisposedError';
|
170
177
|
Error.call(this);
|
171
178
|
};
|
172
179
|
ObjectDisposedError.prototype = Error.prototype;
|
173
180
|
|
174
181
|
var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () {
|
175
182
|
this.message = 'Argument out of range';
|
183
|
+
this.name = 'ArgumentOutOfRangeError';
|
176
184
|
Error.call(this);
|
177
185
|
};
|
178
186
|
ArgumentOutOfRangeError.prototype = Error.prototype;
|
179
187
|
|
180
188
|
var NotSupportedError = Rx.NotSupportedError = function (message) {
|
181
189
|
this.message = message || 'This operation is not supported';
|
190
|
+
this.name = 'NotSupportedError';
|
182
191
|
Error.call(this);
|
183
192
|
};
|
184
193
|
NotSupportedError.prototype = Error.prototype;
|
185
194
|
|
186
195
|
var NotImplementedError = Rx.NotImplementedError = function (message) {
|
187
196
|
this.message = message || 'This operation is not implemented';
|
197
|
+
this.name = 'NotImplementedError';
|
188
198
|
Error.call(this);
|
189
199
|
};
|
190
200
|
NotImplementedError.prototype = Error.prototype;
|
@@ -531,7 +541,7 @@
|
|
531
541
|
var hasProp = {}.hasOwnProperty,
|
532
542
|
slice = Array.prototype.slice;
|
533
543
|
|
534
|
-
var inherits =
|
544
|
+
var inherits = Rx.internals.inherits = function (child, parent) {
|
535
545
|
function __() { this.constructor = child; }
|
536
546
|
__.prototype = parent.prototype;
|
537
547
|
child.prototype = new __();
|
@@ -562,25 +572,6 @@
|
|
562
572
|
return a;
|
563
573
|
}
|
564
574
|
|
565
|
-
var errorObj = {e: {}};
|
566
|
-
var tryCatchTarget;
|
567
|
-
function tryCatcher() {
|
568
|
-
try {
|
569
|
-
return tryCatchTarget.apply(this, arguments);
|
570
|
-
} catch (e) {
|
571
|
-
errorObj.e = e;
|
572
|
-
return errorObj;
|
573
|
-
}
|
574
|
-
}
|
575
|
-
function tryCatch(fn) {
|
576
|
-
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
|
577
|
-
tryCatchTarget = fn;
|
578
|
-
return tryCatcher;
|
579
|
-
}
|
580
|
-
function thrower(e) {
|
581
|
-
throw e;
|
582
|
-
}
|
583
|
-
|
584
575
|
// Utilities
|
585
576
|
if (!Function.prototype.bind) {
|
586
577
|
Function.prototype.bind = function (that) {
|
@@ -770,92 +761,6 @@
|
|
770
761
|
}());
|
771
762
|
}
|
772
763
|
|
773
|
-
// Collections
|
774
|
-
function IndexedItem(id, value) {
|
775
|
-
this.id = id;
|
776
|
-
this.value = value;
|
777
|
-
}
|
778
|
-
|
779
|
-
IndexedItem.prototype.compareTo = function (other) {
|
780
|
-
var c = this.value.compareTo(other.value);
|
781
|
-
c === 0 && (c = this.id - other.id);
|
782
|
-
return c;
|
783
|
-
};
|
784
|
-
|
785
|
-
// Priority Queue for Scheduling
|
786
|
-
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
|
787
|
-
this.items = new Array(capacity);
|
788
|
-
this.length = 0;
|
789
|
-
};
|
790
|
-
|
791
|
-
var priorityProto = PriorityQueue.prototype;
|
792
|
-
priorityProto.isHigherPriority = function (left, right) {
|
793
|
-
return this.items[left].compareTo(this.items[right]) < 0;
|
794
|
-
};
|
795
|
-
|
796
|
-
priorityProto.percolate = function (index) {
|
797
|
-
if (index >= this.length || index < 0) { return; }
|
798
|
-
var parent = index - 1 >> 1;
|
799
|
-
if (parent < 0 || parent === index) { return; }
|
800
|
-
if (this.isHigherPriority(index, parent)) {
|
801
|
-
var temp = this.items[index];
|
802
|
-
this.items[index] = this.items[parent];
|
803
|
-
this.items[parent] = temp;
|
804
|
-
this.percolate(parent);
|
805
|
-
}
|
806
|
-
};
|
807
|
-
|
808
|
-
priorityProto.heapify = function (index) {
|
809
|
-
+index || (index = 0);
|
810
|
-
if (index >= this.length || index < 0) { return; }
|
811
|
-
var left = 2 * index + 1,
|
812
|
-
right = 2 * index + 2,
|
813
|
-
first = index;
|
814
|
-
if (left < this.length && this.isHigherPriority(left, first)) {
|
815
|
-
first = left;
|
816
|
-
}
|
817
|
-
if (right < this.length && this.isHigherPriority(right, first)) {
|
818
|
-
first = right;
|
819
|
-
}
|
820
|
-
if (first !== index) {
|
821
|
-
var temp = this.items[index];
|
822
|
-
this.items[index] = this.items[first];
|
823
|
-
this.items[first] = temp;
|
824
|
-
this.heapify(first);
|
825
|
-
}
|
826
|
-
};
|
827
|
-
|
828
|
-
priorityProto.peek = function () { return this.items[0].value; };
|
829
|
-
|
830
|
-
priorityProto.removeAt = function (index) {
|
831
|
-
this.items[index] = this.items[--this.length];
|
832
|
-
this.items[this.length] = undefined;
|
833
|
-
this.heapify();
|
834
|
-
};
|
835
|
-
|
836
|
-
priorityProto.dequeue = function () {
|
837
|
-
var result = this.peek();
|
838
|
-
this.removeAt(0);
|
839
|
-
return result;
|
840
|
-
};
|
841
|
-
|
842
|
-
priorityProto.enqueue = function (item) {
|
843
|
-
var index = this.length++;
|
844
|
-
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
|
845
|
-
this.percolate(index);
|
846
|
-
};
|
847
|
-
|
848
|
-
priorityProto.remove = function (item) {
|
849
|
-
for (var i = 0; i < this.length; i++) {
|
850
|
-
if (this.items[i].value === item) {
|
851
|
-
this.removeAt(i);
|
852
|
-
return true;
|
853
|
-
}
|
854
|
-
}
|
855
|
-
return false;
|
856
|
-
};
|
857
|
-
PriorityQueue.count = 0;
|
858
|
-
|
859
764
|
/**
|
860
765
|
* Represents a group of disposable resources that are disposed together.
|
861
766
|
* @constructor
|
@@ -1225,52 +1130,62 @@
|
|
1225
1130
|
|
1226
1131
|
function invokeRecImmediate(scheduler, pair) {
|
1227
1132
|
var state = pair[0], action = pair[1], group = new CompositeDisposable();
|
1133
|
+
action(state, innerAction);
|
1134
|
+
return group;
|
1228
1135
|
|
1229
|
-
function
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
isAdded = true;
|
1136
|
+
function innerAction(state2) {
|
1137
|
+
var isAdded = false, isDone = false;
|
1138
|
+
|
1139
|
+
var d = scheduler.scheduleWithState(state2, scheduleWork);
|
1140
|
+
if (!isDone) {
|
1141
|
+
group.add(d);
|
1142
|
+
isAdded = true;
|
1143
|
+
}
|
1144
|
+
|
1145
|
+
function scheduleWork(_, state3) {
|
1146
|
+
if (isAdded) {
|
1147
|
+
group.remove(d);
|
1148
|
+
} else {
|
1149
|
+
isDone = true;
|
1244
1150
|
}
|
1245
|
-
|
1151
|
+
action(state3, innerAction);
|
1152
|
+
return disposableEmpty;
|
1153
|
+
}
|
1246
1154
|
}
|
1247
|
-
|
1248
|
-
recursiveAction(state);
|
1249
|
-
return group;
|
1250
1155
|
}
|
1251
1156
|
|
1252
1157
|
function invokeRecDate(scheduler, pair, method) {
|
1253
1158
|
var state = pair[0], action = pair[1], group = new CompositeDisposable();
|
1254
|
-
|
1255
|
-
action(state1, function (state2, dueTime1) {
|
1256
|
-
var isAdded = false, isDone = false,
|
1257
|
-
d = scheduler[method](state2, dueTime1, function (scheduler1, state3) {
|
1258
|
-
if (isAdded) {
|
1259
|
-
group.remove(d);
|
1260
|
-
} else {
|
1261
|
-
isDone = true;
|
1262
|
-
}
|
1263
|
-
recursiveAction(state3);
|
1264
|
-
return disposableEmpty;
|
1265
|
-
});
|
1266
|
-
if (!isDone) {
|
1267
|
-
group.add(d);
|
1268
|
-
isAdded = true;
|
1269
|
-
}
|
1270
|
-
});
|
1271
|
-
};
|
1272
|
-
recursiveAction(state);
|
1159
|
+
action(state, innerAction);
|
1273
1160
|
return group;
|
1161
|
+
|
1162
|
+
function innerAction(state2, dueTime1) {
|
1163
|
+
var isAdded = false, isDone = false;
|
1164
|
+
|
1165
|
+
var d = scheduler[method](state2, dueTime1, scheduleWork);
|
1166
|
+
if (!isDone) {
|
1167
|
+
group.add(d);
|
1168
|
+
isAdded = true;
|
1169
|
+
}
|
1170
|
+
|
1171
|
+
function scheduleWork(_, state3) {
|
1172
|
+
if (isAdded) {
|
1173
|
+
group.remove(d);
|
1174
|
+
} else {
|
1175
|
+
isDone = true;
|
1176
|
+
}
|
1177
|
+
action(state3, innerAction);
|
1178
|
+
return disposableEmpty;
|
1179
|
+
}
|
1180
|
+
}
|
1181
|
+
}
|
1182
|
+
|
1183
|
+
function invokeRecDateRelative(s, p) {
|
1184
|
+
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
|
1185
|
+
}
|
1186
|
+
|
1187
|
+
function invokeRecDateAbsolute(s, p) {
|
1188
|
+
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
|
1274
1189
|
}
|
1275
1190
|
|
1276
1191
|
function scheduleInnerRecursive(action, self) {
|
@@ -1283,8 +1198,7 @@
|
|
1283
1198
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
1284
1199
|
*/
|
1285
1200
|
schedulerProto.scheduleRecursive = function (action) {
|
1286
|
-
return this.scheduleRecursiveWithState(action,
|
1287
|
-
_action(function () { self(_action); }); });
|
1201
|
+
return this.scheduleRecursiveWithState(action, scheduleInnerRecursive);
|
1288
1202
|
};
|
1289
1203
|
|
1290
1204
|
/**
|
@@ -1315,9 +1229,7 @@
|
|
1315
1229
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
1316
1230
|
*/
|
1317
1231
|
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
|
1318
|
-
return this._scheduleRelative([state, action], dueTime,
|
1319
|
-
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
|
1320
|
-
});
|
1232
|
+
return this._scheduleRelative([state, action], dueTime, invokeRecDateRelative);
|
1321
1233
|
};
|
1322
1234
|
|
1323
1235
|
/**
|
@@ -1338,9 +1250,7 @@
|
|
1338
1250
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
1339
1251
|
*/
|
1340
1252
|
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
|
1341
|
-
return this._scheduleAbsolute([state, action], dueTime,
|
1342
|
-
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
|
1343
|
-
});
|
1253
|
+
return this._scheduleAbsolute([state, action], dueTime, invokeRecDateAbsolute);
|
1344
1254
|
};
|
1345
1255
|
}(Scheduler.prototype));
|
1346
1256
|
|
@@ -1426,7 +1336,7 @@
|
|
1426
1336
|
|
1427
1337
|
function runTrampoline () {
|
1428
1338
|
while (queue.length > 0) {
|
1429
|
-
var item = queue.
|
1339
|
+
var item = queue.shift();
|
1430
1340
|
!item.isCancelled() && item.invoke();
|
1431
1341
|
}
|
1432
1342
|
}
|
@@ -1435,14 +1345,13 @@
|
|
1435
1345
|
var si = new ScheduledItem(this, state, action, this.now());
|
1436
1346
|
|
1437
1347
|
if (!queue) {
|
1438
|
-
queue =
|
1439
|
-
queue.enqueue(si);
|
1348
|
+
queue = [si];
|
1440
1349
|
|
1441
1350
|
var result = tryCatch(runTrampoline)();
|
1442
1351
|
queue = null;
|
1443
1352
|
if (result === errorObj) { return thrower(result.e); }
|
1444
1353
|
} else {
|
1445
|
-
queue.
|
1354
|
+
queue.push(si);
|
1446
1355
|
}
|
1447
1356
|
return si.disposable;
|
1448
1357
|
}
|
@@ -1801,188 +1710,6 @@
|
|
1801
1710
|
};
|
1802
1711
|
}());
|
1803
1712
|
|
1804
|
-
var Enumerator = Rx.internals.Enumerator = function (next) {
|
1805
|
-
this._next = next;
|
1806
|
-
};
|
1807
|
-
|
1808
|
-
Enumerator.prototype.next = function () {
|
1809
|
-
return this._next();
|
1810
|
-
};
|
1811
|
-
|
1812
|
-
Enumerator.prototype[$iterator$] = function () { return this; }
|
1813
|
-
|
1814
|
-
var Enumerable = Rx.internals.Enumerable = function (iterator) {
|
1815
|
-
this._iterator = iterator;
|
1816
|
-
};
|
1817
|
-
|
1818
|
-
Enumerable.prototype[$iterator$] = function () {
|
1819
|
-
return this._iterator();
|
1820
|
-
};
|
1821
|
-
|
1822
|
-
Enumerable.prototype.concat = function () {
|
1823
|
-
var sources = this;
|
1824
|
-
return new AnonymousObservable(function (o) {
|
1825
|
-
var e = sources[$iterator$]();
|
1826
|
-
|
1827
|
-
var isDisposed, subscription = new SerialDisposable();
|
1828
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1829
|
-
if (isDisposed) { return; }
|
1830
|
-
try {
|
1831
|
-
var currentItem = e.next();
|
1832
|
-
} catch (ex) {
|
1833
|
-
return o.onError(ex);
|
1834
|
-
}
|
1835
|
-
|
1836
|
-
if (currentItem.done) {
|
1837
|
-
return o.onCompleted();
|
1838
|
-
}
|
1839
|
-
|
1840
|
-
// Check if promise
|
1841
|
-
var currentValue = currentItem.value;
|
1842
|
-
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1843
|
-
|
1844
|
-
var d = new SingleAssignmentDisposable();
|
1845
|
-
subscription.setDisposable(d);
|
1846
|
-
d.setDisposable(currentValue.subscribe(
|
1847
|
-
function(x) { o.onNext(x); },
|
1848
|
-
function(err) { o.onError(err); },
|
1849
|
-
self)
|
1850
|
-
);
|
1851
|
-
});
|
1852
|
-
|
1853
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1854
|
-
isDisposed = true;
|
1855
|
-
}));
|
1856
|
-
});
|
1857
|
-
};
|
1858
|
-
|
1859
|
-
Enumerable.prototype.catchError = function () {
|
1860
|
-
var sources = this;
|
1861
|
-
return new AnonymousObservable(function (o) {
|
1862
|
-
var e = sources[$iterator$]();
|
1863
|
-
|
1864
|
-
var isDisposed, subscription = new SerialDisposable();
|
1865
|
-
var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) {
|
1866
|
-
if (isDisposed) { return; }
|
1867
|
-
|
1868
|
-
try {
|
1869
|
-
var currentItem = e.next();
|
1870
|
-
} catch (ex) {
|
1871
|
-
return observer.onError(ex);
|
1872
|
-
}
|
1873
|
-
|
1874
|
-
if (currentItem.done) {
|
1875
|
-
if (lastException !== null) {
|
1876
|
-
o.onError(lastException);
|
1877
|
-
} else {
|
1878
|
-
o.onCompleted();
|
1879
|
-
}
|
1880
|
-
return;
|
1881
|
-
}
|
1882
|
-
|
1883
|
-
// Check if promise
|
1884
|
-
var currentValue = currentItem.value;
|
1885
|
-
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1886
|
-
|
1887
|
-
var d = new SingleAssignmentDisposable();
|
1888
|
-
subscription.setDisposable(d);
|
1889
|
-
d.setDisposable(currentValue.subscribe(
|
1890
|
-
function(x) { o.onNext(x); },
|
1891
|
-
self,
|
1892
|
-
function() { o.onCompleted(); }));
|
1893
|
-
});
|
1894
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1895
|
-
isDisposed = true;
|
1896
|
-
}));
|
1897
|
-
});
|
1898
|
-
};
|
1899
|
-
|
1900
|
-
|
1901
|
-
Enumerable.prototype.catchErrorWhen = function (notificationHandler) {
|
1902
|
-
var sources = this;
|
1903
|
-
return new AnonymousObservable(function (o) {
|
1904
|
-
var exceptions = new Subject(),
|
1905
|
-
notifier = new Subject(),
|
1906
|
-
handled = notificationHandler(exceptions),
|
1907
|
-
notificationDisposable = handled.subscribe(notifier);
|
1908
|
-
|
1909
|
-
var e = sources[$iterator$]();
|
1910
|
-
|
1911
|
-
var isDisposed,
|
1912
|
-
lastException,
|
1913
|
-
subscription = new SerialDisposable();
|
1914
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1915
|
-
if (isDisposed) { return; }
|
1916
|
-
|
1917
|
-
try {
|
1918
|
-
var currentItem = e.next();
|
1919
|
-
} catch (ex) {
|
1920
|
-
return o.onError(ex);
|
1921
|
-
}
|
1922
|
-
|
1923
|
-
if (currentItem.done) {
|
1924
|
-
if (lastException) {
|
1925
|
-
o.onError(lastException);
|
1926
|
-
} else {
|
1927
|
-
o.onCompleted();
|
1928
|
-
}
|
1929
|
-
return;
|
1930
|
-
}
|
1931
|
-
|
1932
|
-
// Check if promise
|
1933
|
-
var currentValue = currentItem.value;
|
1934
|
-
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1935
|
-
|
1936
|
-
var outer = new SingleAssignmentDisposable();
|
1937
|
-
var inner = new SingleAssignmentDisposable();
|
1938
|
-
subscription.setDisposable(new CompositeDisposable(inner, outer));
|
1939
|
-
outer.setDisposable(currentValue.subscribe(
|
1940
|
-
function(x) { o.onNext(x); },
|
1941
|
-
function (exn) {
|
1942
|
-
inner.setDisposable(notifier.subscribe(self, function(ex) {
|
1943
|
-
o.onError(ex);
|
1944
|
-
}, function() {
|
1945
|
-
o.onCompleted();
|
1946
|
-
}));
|
1947
|
-
|
1948
|
-
exceptions.onNext(exn);
|
1949
|
-
},
|
1950
|
-
function() { o.onCompleted(); }));
|
1951
|
-
});
|
1952
|
-
|
1953
|
-
return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function () {
|
1954
|
-
isDisposed = true;
|
1955
|
-
}));
|
1956
|
-
});
|
1957
|
-
};
|
1958
|
-
|
1959
|
-
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
1960
|
-
if (repeatCount == null) { repeatCount = -1; }
|
1961
|
-
return new Enumerable(function () {
|
1962
|
-
var left = repeatCount;
|
1963
|
-
return new Enumerator(function () {
|
1964
|
-
if (left === 0) { return doneEnumerator; }
|
1965
|
-
if (left > 0) { left--; }
|
1966
|
-
return { done: false, value: value };
|
1967
|
-
});
|
1968
|
-
});
|
1969
|
-
};
|
1970
|
-
|
1971
|
-
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
|
1972
|
-
if (selector) {
|
1973
|
-
var selectorFn = bindCallback(selector, thisArg, 3);
|
1974
|
-
}
|
1975
|
-
return new Enumerable(function () {
|
1976
|
-
var index = -1;
|
1977
|
-
return new Enumerator(
|
1978
|
-
function () {
|
1979
|
-
return ++index < source.length ?
|
1980
|
-
{ done: false, value: !selector ? source[index] : selectorFn(source[index], index, source) } :
|
1981
|
-
doneEnumerator;
|
1982
|
-
});
|
1983
|
-
});
|
1984
|
-
};
|
1985
|
-
|
1986
1713
|
/**
|
1987
1714
|
* Supports push-style iteration over an observable sequence.
|
1988
1715
|
*/
|
@@ -2002,7 +1729,11 @@
|
|
2002
1729
|
* @returns An observer that hides the identity of the specified observer.
|
2003
1730
|
*/
|
2004
1731
|
Observer.prototype.asObserver = function () {
|
2005
|
-
|
1732
|
+
var self = this;
|
1733
|
+
return new AnonymousObserver(
|
1734
|
+
function (x) { self.onNext(x); },
|
1735
|
+
function (err) { self.onError(err); },
|
1736
|
+
function () { self.onCompleted(); });
|
2006
1737
|
};
|
2007
1738
|
|
2008
1739
|
/**
|
@@ -2035,12 +1766,13 @@
|
|
2035
1766
|
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
|
2036
1767
|
*/
|
2037
1768
|
Observer.fromNotifier = function (handler, thisArg) {
|
1769
|
+
var cb = bindCallback(handler, thisArg, 1);
|
2038
1770
|
return new AnonymousObserver(function (x) {
|
2039
|
-
return
|
1771
|
+
return cb(notificationCreateOnNext(x));
|
2040
1772
|
}, function (e) {
|
2041
|
-
return
|
1773
|
+
return cb(notificationCreateOnError(e));
|
2042
1774
|
}, function () {
|
2043
|
-
return
|
1775
|
+
return cb(notificationCreateOnCompleted());
|
2044
1776
|
});
|
2045
1777
|
};
|
2046
1778
|
|
@@ -2069,7 +1801,6 @@
|
|
2069
1801
|
*/
|
2070
1802
|
function AbstractObserver() {
|
2071
1803
|
this.isStopped = false;
|
2072
|
-
__super__.call(this);
|
2073
1804
|
}
|
2074
1805
|
|
2075
1806
|
// Must be implemented by other observers
|
@@ -2082,7 +1813,7 @@
|
|
2082
1813
|
* @param {Any} value Next element in the sequence.
|
2083
1814
|
*/
|
2084
1815
|
AbstractObserver.prototype.onNext = function (value) {
|
2085
|
-
|
1816
|
+
!this.isStopped && this.next(value);
|
2086
1817
|
};
|
2087
1818
|
|
2088
1819
|
/**
|
@@ -2109,9 +1840,7 @@
|
|
2109
1840
|
/**
|
2110
1841
|
* Disposes the observer, causing it to transition to the stopped state.
|
2111
1842
|
*/
|
2112
|
-
AbstractObserver.prototype.dispose = function () {
|
2113
|
-
this.isStopped = true;
|
2114
|
-
};
|
1843
|
+
AbstractObserver.prototype.dispose = function () { this.isStopped = true; };
|
2115
1844
|
|
2116
1845
|
AbstractObserver.prototype.fail = function (e) {
|
2117
1846
|
if (!this.isStopped) {
|
@@ -2241,13 +1970,13 @@
|
|
2241
1970
|
};
|
2242
1971
|
|
2243
1972
|
ScheduledObserver.prototype.ensureActive = function () {
|
2244
|
-
var isOwner = false
|
1973
|
+
var isOwner = false;
|
2245
1974
|
if (!this.hasFaulted && this.queue.length > 0) {
|
2246
1975
|
isOwner = !this.isAcquired;
|
2247
1976
|
this.isAcquired = true;
|
2248
1977
|
}
|
2249
1978
|
if (isOwner) {
|
2250
|
-
this.disposable.setDisposable(this.scheduler.
|
1979
|
+
this.disposable.setDisposable(this.scheduler.scheduleRecursiveWithState(this, function (parent, self) {
|
2251
1980
|
var work;
|
2252
1981
|
if (parent.queue.length > 0) {
|
2253
1982
|
work = parent.queue.shift();
|
@@ -2255,14 +1984,13 @@
|
|
2255
1984
|
parent.isAcquired = false;
|
2256
1985
|
return;
|
2257
1986
|
}
|
2258
|
-
|
2259
|
-
|
2260
|
-
} catch (ex) {
|
1987
|
+
var res = tryCatch(work)();
|
1988
|
+
if (res === errorObj) {
|
2261
1989
|
parent.queue = [];
|
2262
1990
|
parent.hasFaulted = true;
|
2263
|
-
|
1991
|
+
return thrower(res.e);
|
2264
1992
|
}
|
2265
|
-
self();
|
1993
|
+
self(parent);
|
2266
1994
|
}));
|
2267
1995
|
}
|
2268
1996
|
};
|
@@ -2314,25 +2042,23 @@
|
|
2314
2042
|
*/
|
2315
2043
|
var Observable = Rx.Observable = (function () {
|
2316
2044
|
|
2317
|
-
function
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
}
|
2324
|
-
|
2325
|
-
var self = this;
|
2326
|
-
this._subscribe = function (observer) {
|
2327
|
-
var oldOnError = observer.onError.bind(observer);
|
2045
|
+
function makeSubscribe(self, subscribe) {
|
2046
|
+
return function (o) {
|
2047
|
+
var oldOnError = o.onError;
|
2048
|
+
o.onError = function (e) {
|
2049
|
+
makeStackTraceLong(e, self);
|
2050
|
+
oldOnError.call(o, e);
|
2051
|
+
};
|
2328
2052
|
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2332
|
-
};
|
2053
|
+
return subscribe.call(self, o);
|
2054
|
+
};
|
2055
|
+
}
|
2333
2056
|
|
2334
|
-
|
2335
|
-
|
2057
|
+
function Observable(subscribe) {
|
2058
|
+
if (Rx.config.longStackSupport && hasStacks) {
|
2059
|
+
var e = tryCatch(thrower)(new Error()).e;
|
2060
|
+
this.stack = e.stack.substring(e.stack.indexOf('\n') + 1);
|
2061
|
+
this._subscribe = makeSubscribe(this, subscribe);
|
2336
2062
|
} else {
|
2337
2063
|
this._subscribe = subscribe;
|
2338
2064
|
}
|
@@ -2341,16 +2067,25 @@
|
|
2341
2067
|
observableProto = Observable.prototype;
|
2342
2068
|
|
2343
2069
|
/**
|
2344
|
-
|
2345
|
-
|
2070
|
+
* Determines whether the given object is an Observable
|
2071
|
+
* @param {Any} An object to determine whether it is an Observable
|
2072
|
+
* @returns {Boolean} true if an Observable, else false.
|
2073
|
+
*/
|
2074
|
+
Observable.isObservable = function (o) {
|
2075
|
+
return o && isFunction(o.subscribe);
|
2076
|
+
}
|
2077
|
+
|
2078
|
+
/**
|
2079
|
+
* Subscribes an o to the observable sequence.
|
2080
|
+
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
|
2346
2081
|
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
|
2347
2082
|
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
|
2348
2083
|
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
|
2349
2084
|
*/
|
2350
|
-
observableProto.subscribe = observableProto.forEach = function (
|
2351
|
-
return this._subscribe(typeof
|
2352
|
-
|
2353
|
-
observerCreate(
|
2085
|
+
observableProto.subscribe = observableProto.forEach = function (oOrOnNext, onError, onCompleted) {
|
2086
|
+
return this._subscribe(typeof oOrOnNext === 'object' ?
|
2087
|
+
oOrOnNext :
|
2088
|
+
observerCreate(oOrOnNext, onError, onCompleted));
|
2354
2089
|
};
|
2355
2090
|
|
2356
2091
|
/**
|
@@ -2424,6 +2159,294 @@
|
|
2424
2159
|
return ObservableBase;
|
2425
2160
|
}(Observable));
|
2426
2161
|
|
2162
|
+
var FlatMapObservable = (function(__super__){
|
2163
|
+
|
2164
|
+
inherits(FlatMapObservable, __super__);
|
2165
|
+
|
2166
|
+
function FlatMapObservable(source, selector, resultSelector, thisArg) {
|
2167
|
+
this.resultSelector = Rx.helpers.isFunction(resultSelector) ?
|
2168
|
+
resultSelector : null;
|
2169
|
+
|
2170
|
+
this.selector = Rx.internals.bindCallback(Rx.helpers.isFunction(selector) ? selector : function() { return selector; }, thisArg, 3);
|
2171
|
+
this.source = source;
|
2172
|
+
|
2173
|
+
__super__.call(this);
|
2174
|
+
|
2175
|
+
}
|
2176
|
+
|
2177
|
+
FlatMapObservable.prototype.subscribeCore = function(o) {
|
2178
|
+
return this.source.subscribe(new InnerObserver(o, this.selector, this.resultSelector, this));
|
2179
|
+
};
|
2180
|
+
|
2181
|
+
function InnerObserver(observer, selector, resultSelector, source) {
|
2182
|
+
this.i = 0;
|
2183
|
+
this.selector = selector;
|
2184
|
+
this.resultSelector = resultSelector;
|
2185
|
+
this.source = source;
|
2186
|
+
this.isStopped = false;
|
2187
|
+
this.o = observer;
|
2188
|
+
}
|
2189
|
+
|
2190
|
+
InnerObserver.prototype._wrapResult = function(result, x, i) {
|
2191
|
+
return this.resultSelector ?
|
2192
|
+
result.map(function(y, i2) { return this.resultSelector(x, y, i, i2); }, this) :
|
2193
|
+
result;
|
2194
|
+
};
|
2195
|
+
|
2196
|
+
InnerObserver.prototype.onNext = function(x) {
|
2197
|
+
|
2198
|
+
if (this.isStopped) return;
|
2199
|
+
|
2200
|
+
var i = this.i++;
|
2201
|
+
var result = tryCatch(this.selector)(x, i, this.source);
|
2202
|
+
|
2203
|
+
if (result === errorObj) {
|
2204
|
+
return this.o.onError(result.e);
|
2205
|
+
}
|
2206
|
+
|
2207
|
+
Rx.helpers.isPromise(result) && (result = Rx.Observable.fromPromise(result));
|
2208
|
+
(Rx.helpers.isArrayLike(result) || Rx.helpers.isIterable(result)) && (result = Rx.Observable.from(result));
|
2209
|
+
|
2210
|
+
this.o.onNext(this._wrapResult(result, x, i));
|
2211
|
+
|
2212
|
+
};
|
2213
|
+
|
2214
|
+
InnerObserver.prototype.onError = function(e) {
|
2215
|
+
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
|
2216
|
+
};
|
2217
|
+
|
2218
|
+
InnerObserver.prototype.onCompleted = function() {
|
2219
|
+
if (!this.isStopped) {this.isStopped = true; this.o.onCompleted(); }
|
2220
|
+
};
|
2221
|
+
|
2222
|
+
return FlatMapObservable;
|
2223
|
+
|
2224
|
+
}(ObservableBase));
|
2225
|
+
|
2226
|
+
var Enumerable = Rx.internals.Enumerable = function () { };
|
2227
|
+
|
2228
|
+
var ConcatEnumerableObservable = (function(__super__) {
|
2229
|
+
inherits(ConcatEnumerableObservable, __super__);
|
2230
|
+
function ConcatEnumerableObservable(sources) {
|
2231
|
+
this.sources = sources;
|
2232
|
+
__super__.call(this);
|
2233
|
+
}
|
2234
|
+
|
2235
|
+
ConcatEnumerableObservable.prototype.subscribeCore = function (o) {
|
2236
|
+
var isDisposed, subscription = new SerialDisposable();
|
2237
|
+
var cancelable = immediateScheduler.scheduleRecursiveWithState(this.sources[$iterator$](), function (e, self) {
|
2238
|
+
if (isDisposed) { return; }
|
2239
|
+
var currentItem = tryCatch(e.next).call(e);
|
2240
|
+
if (currentItem === errorObj) { return o.onError(currentItem.e); }
|
2241
|
+
|
2242
|
+
if (currentItem.done) {
|
2243
|
+
return o.onCompleted();
|
2244
|
+
}
|
2245
|
+
|
2246
|
+
// Check if promise
|
2247
|
+
var currentValue = currentItem.value;
|
2248
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
2249
|
+
|
2250
|
+
var d = new SingleAssignmentDisposable();
|
2251
|
+
subscription.setDisposable(d);
|
2252
|
+
d.setDisposable(currentValue.subscribe(new InnerObserver(o, self, e)));
|
2253
|
+
});
|
2254
|
+
|
2255
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
2256
|
+
isDisposed = true;
|
2257
|
+
}));
|
2258
|
+
};
|
2259
|
+
|
2260
|
+
function InnerObserver(o, s, e) {
|
2261
|
+
this.o = o;
|
2262
|
+
this.s = s;
|
2263
|
+
this.e = e;
|
2264
|
+
this.isStopped = false;
|
2265
|
+
}
|
2266
|
+
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.o.onNext(x); } };
|
2267
|
+
InnerObserver.prototype.onError = function (err) {
|
2268
|
+
if (!this.isStopped) {
|
2269
|
+
this.isStopped = true;
|
2270
|
+
this.o.onError(err);
|
2271
|
+
}
|
2272
|
+
};
|
2273
|
+
InnerObserver.prototype.onCompleted = function () {
|
2274
|
+
if (!this.isStopped) {
|
2275
|
+
this.isStopped = true;
|
2276
|
+
this.s(this.e);
|
2277
|
+
}
|
2278
|
+
};
|
2279
|
+
InnerObserver.prototype.dispose = function () { this.isStopped = true; };
|
2280
|
+
InnerObserver.prototype.fail = function (err) {
|
2281
|
+
if (!this.isStopped) {
|
2282
|
+
this.isStopped = true;
|
2283
|
+
this.o.onError(err);
|
2284
|
+
return true;
|
2285
|
+
}
|
2286
|
+
return false;
|
2287
|
+
};
|
2288
|
+
|
2289
|
+
return ConcatEnumerableObservable;
|
2290
|
+
}(ObservableBase));
|
2291
|
+
|
2292
|
+
Enumerable.prototype.concat = function () {
|
2293
|
+
return new ConcatEnumerableObservable(this);
|
2294
|
+
};
|
2295
|
+
|
2296
|
+
var CatchErrorObservable = (function(__super__) {
|
2297
|
+
inherits(CatchErrorObservable, __super__);
|
2298
|
+
function CatchErrorObservable(sources) {
|
2299
|
+
this.sources = sources;
|
2300
|
+
__super__.call(this);
|
2301
|
+
}
|
2302
|
+
|
2303
|
+
CatchErrorObservable.prototype.subscribeCore = function (o) {
|
2304
|
+
var e = this.sources[$iterator$]();
|
2305
|
+
|
2306
|
+
var isDisposed, subscription = new SerialDisposable();
|
2307
|
+
var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) {
|
2308
|
+
if (isDisposed) { return; }
|
2309
|
+
var currentItem = tryCatch(e.next).call(e);
|
2310
|
+
if (currentItem === errorObj) { return o.onError(currentItem.e); }
|
2311
|
+
|
2312
|
+
if (currentItem.done) {
|
2313
|
+
return lastException !== null ? o.onError(lastException) : o.onCompleted();
|
2314
|
+
}
|
2315
|
+
|
2316
|
+
// Check if promise
|
2317
|
+
var currentValue = currentItem.value;
|
2318
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
2319
|
+
|
2320
|
+
var d = new SingleAssignmentDisposable();
|
2321
|
+
subscription.setDisposable(d);
|
2322
|
+
d.setDisposable(currentValue.subscribe(
|
2323
|
+
function(x) { o.onNext(x); },
|
2324
|
+
self,
|
2325
|
+
function() { o.onCompleted(); }));
|
2326
|
+
});
|
2327
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
2328
|
+
isDisposed = true;
|
2329
|
+
}));
|
2330
|
+
};
|
2331
|
+
|
2332
|
+
return CatchErrorObservable;
|
2333
|
+
}(ObservableBase));
|
2334
|
+
|
2335
|
+
Enumerable.prototype.catchError = function () {
|
2336
|
+
return new CatchErrorObservable(this);
|
2337
|
+
};
|
2338
|
+
|
2339
|
+
Enumerable.prototype.catchErrorWhen = function (notificationHandler) {
|
2340
|
+
var sources = this;
|
2341
|
+
return new AnonymousObservable(function (o) {
|
2342
|
+
var exceptions = new Subject(),
|
2343
|
+
notifier = new Subject(),
|
2344
|
+
handled = notificationHandler(exceptions),
|
2345
|
+
notificationDisposable = handled.subscribe(notifier);
|
2346
|
+
|
2347
|
+
var e = sources[$iterator$]();
|
2348
|
+
|
2349
|
+
var isDisposed,
|
2350
|
+
lastException,
|
2351
|
+
subscription = new SerialDisposable();
|
2352
|
+
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
2353
|
+
if (isDisposed) { return; }
|
2354
|
+
var currentItem = tryCatch(e.next).call(e);
|
2355
|
+
if (currentItem === errorObj) { return o.onError(currentItem.e); }
|
2356
|
+
|
2357
|
+
if (currentItem.done) {
|
2358
|
+
if (lastException) {
|
2359
|
+
o.onError(lastException);
|
2360
|
+
} else {
|
2361
|
+
o.onCompleted();
|
2362
|
+
}
|
2363
|
+
return;
|
2364
|
+
}
|
2365
|
+
|
2366
|
+
// Check if promise
|
2367
|
+
var currentValue = currentItem.value;
|
2368
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
2369
|
+
|
2370
|
+
var outer = new SingleAssignmentDisposable();
|
2371
|
+
var inner = new SingleAssignmentDisposable();
|
2372
|
+
subscription.setDisposable(new CompositeDisposable(inner, outer));
|
2373
|
+
outer.setDisposable(currentValue.subscribe(
|
2374
|
+
function(x) { o.onNext(x); },
|
2375
|
+
function (exn) {
|
2376
|
+
inner.setDisposable(notifier.subscribe(self, function(ex) {
|
2377
|
+
o.onError(ex);
|
2378
|
+
}, function() {
|
2379
|
+
o.onCompleted();
|
2380
|
+
}));
|
2381
|
+
|
2382
|
+
exceptions.onNext(exn);
|
2383
|
+
},
|
2384
|
+
function() { o.onCompleted(); }));
|
2385
|
+
});
|
2386
|
+
|
2387
|
+
return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function () {
|
2388
|
+
isDisposed = true;
|
2389
|
+
}));
|
2390
|
+
});
|
2391
|
+
};
|
2392
|
+
|
2393
|
+
var RepeatEnumerable = (function (__super__) {
|
2394
|
+
inherits(RepeatEnumerable, __super__);
|
2395
|
+
|
2396
|
+
function RepeatEnumerable(v, c) {
|
2397
|
+
this.v = v;
|
2398
|
+
this.c = c == null ? -1 : c;
|
2399
|
+
}
|
2400
|
+
RepeatEnumerable.prototype[$iterator$] = function () {
|
2401
|
+
return new RepeatEnumerator(this);
|
2402
|
+
};
|
2403
|
+
|
2404
|
+
function RepeatEnumerator(p) {
|
2405
|
+
this.v = p.v;
|
2406
|
+
this.l = p.c;
|
2407
|
+
}
|
2408
|
+
RepeatEnumerator.prototype.next = function () {
|
2409
|
+
if (this.l === 0) { return doneEnumerator; }
|
2410
|
+
if (this.l > 0) { this.l--; }
|
2411
|
+
return { done: false, value: this.v };
|
2412
|
+
};
|
2413
|
+
|
2414
|
+
return RepeatEnumerable;
|
2415
|
+
}(Enumerable));
|
2416
|
+
|
2417
|
+
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
2418
|
+
return new RepeatEnumerable(value, repeatCount);
|
2419
|
+
};
|
2420
|
+
|
2421
|
+
var OfEnumerable = (function(__super__) {
|
2422
|
+
inherits(OfEnumerable, __super__);
|
2423
|
+
function OfEnumerable(s, fn, thisArg) {
|
2424
|
+
this.s = s;
|
2425
|
+
this.fn = fn ? bindCallback(fn, thisArg, 3) : null;
|
2426
|
+
}
|
2427
|
+
OfEnumerable.prototype[$iterator$] = function () {
|
2428
|
+
return new OfEnumerator(this);
|
2429
|
+
};
|
2430
|
+
|
2431
|
+
function OfEnumerator(p) {
|
2432
|
+
this.i = -1;
|
2433
|
+
this.s = p.s;
|
2434
|
+
this.l = this.s.length;
|
2435
|
+
this.fn = p.fn;
|
2436
|
+
}
|
2437
|
+
OfEnumerator.prototype.next = function () {
|
2438
|
+
return ++this.i < this.l ?
|
2439
|
+
{ done: false, value: !this.fn ? this.s[this.i] : this.fn(this.s[this.i], this.i, this.s) } :
|
2440
|
+
doneEnumerator;
|
2441
|
+
};
|
2442
|
+
|
2443
|
+
return OfEnumerable;
|
2444
|
+
}(Enumerable));
|
2445
|
+
|
2446
|
+
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
|
2447
|
+
return new OfEnumerable(source, selector, thisArg);
|
2448
|
+
};
|
2449
|
+
|
2427
2450
|
/**
|
2428
2451
|
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
|
2429
2452
|
*
|
@@ -2462,26 +2485,32 @@
|
|
2462
2485
|
}, source);
|
2463
2486
|
};
|
2464
2487
|
|
2465
|
-
|
2466
|
-
|
2467
|
-
|
2468
|
-
|
2469
|
-
|
2470
|
-
|
2471
|
-
return observableDefer(function () {
|
2472
|
-
var subject = new Rx.AsyncSubject();
|
2488
|
+
var FromPromiseObservable = (function(__super__) {
|
2489
|
+
inherits(FromPromiseObservable, __super__);
|
2490
|
+
function FromPromiseObservable(p) {
|
2491
|
+
this.p = p;
|
2492
|
+
__super__.call(this);
|
2493
|
+
}
|
2473
2494
|
|
2474
|
-
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
2478
|
-
|
2479
|
-
|
2495
|
+
FromPromiseObservable.prototype.subscribeCore = function(o) {
|
2496
|
+
this.p.then(function (data) {
|
2497
|
+
o.onNext(data);
|
2498
|
+
o.onCompleted();
|
2499
|
+
}, function (err) { o.onError(err); });
|
2500
|
+
return disposableEmpty;
|
2501
|
+
};
|
2480
2502
|
|
2481
|
-
|
2482
|
-
|
2483
|
-
};
|
2503
|
+
return FromPromiseObservable;
|
2504
|
+
}(ObservableBase));
|
2484
2505
|
|
2506
|
+
/**
|
2507
|
+
* Converts a Promise to an Observable sequence
|
2508
|
+
* @param {Promise} An ES6 Compliant promise.
|
2509
|
+
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
|
2510
|
+
*/
|
2511
|
+
var observableFromPromise = Observable.fromPromise = function (promise) {
|
2512
|
+
return new FromPromiseObservable(promise);
|
2513
|
+
};
|
2485
2514
|
/*
|
2486
2515
|
* Converts an existing observable sequence to an ES6 Compatible Promise
|
2487
2516
|
* @example
|
@@ -2516,42 +2545,42 @@
|
|
2516
2545
|
__super__.call(this);
|
2517
2546
|
}
|
2518
2547
|
|
2519
|
-
ToArrayObservable.prototype.subscribeCore = function(
|
2520
|
-
return this.source.subscribe(new
|
2548
|
+
ToArrayObservable.prototype.subscribeCore = function(o) {
|
2549
|
+
return this.source.subscribe(new InnerObserver(o));
|
2521
2550
|
};
|
2522
2551
|
|
2523
|
-
|
2524
|
-
|
2525
|
-
|
2526
|
-
|
2527
|
-
this.observer = observer;
|
2528
|
-
this.a = [];
|
2529
|
-
this.isStopped = false;
|
2530
|
-
}
|
2531
|
-
ToArrayObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
|
2532
|
-
ToArrayObserver.prototype.onError = function (e) {
|
2533
|
-
if (!this.isStopped) {
|
2534
|
-
this.isStopped = true;
|
2535
|
-
this.observer.onError(e);
|
2536
|
-
}
|
2537
|
-
};
|
2538
|
-
ToArrayObserver.prototype.onCompleted = function () {
|
2539
|
-
if (!this.isStopped) {
|
2540
|
-
this.isStopped = true;
|
2541
|
-
this.observer.onNext(this.a);
|
2542
|
-
this.observer.onCompleted();
|
2543
|
-
}
|
2544
|
-
};
|
2545
|
-
ToArrayObserver.prototype.dispose = function () { this.isStopped = true; }
|
2546
|
-
ToArrayObserver.prototype.fail = function (e) {
|
2547
|
-
if (!this.isStopped) {
|
2548
|
-
this.isStopped = true;
|
2549
|
-
this.observer.onError(e);
|
2550
|
-
return true;
|
2552
|
+
function InnerObserver(o) {
|
2553
|
+
this.o = o;
|
2554
|
+
this.a = [];
|
2555
|
+
this.isStopped = false;
|
2551
2556
|
}
|
2557
|
+
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
|
2558
|
+
InnerObserver.prototype.onError = function (e) {
|
2559
|
+
if (!this.isStopped) {
|
2560
|
+
this.isStopped = true;
|
2561
|
+
this.o.onError(e);
|
2562
|
+
}
|
2563
|
+
};
|
2564
|
+
InnerObserver.prototype.onCompleted = function () {
|
2565
|
+
if (!this.isStopped) {
|
2566
|
+
this.isStopped = true;
|
2567
|
+
this.o.onNext(this.a);
|
2568
|
+
this.o.onCompleted();
|
2569
|
+
}
|
2570
|
+
};
|
2571
|
+
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
|
2572
|
+
InnerObserver.prototype.fail = function (e) {
|
2573
|
+
if (!this.isStopped) {
|
2574
|
+
this.isStopped = true;
|
2575
|
+
this.o.onError(e);
|
2576
|
+
return true;
|
2577
|
+
}
|
2578
|
+
|
2579
|
+
return false;
|
2580
|
+
};
|
2552
2581
|
|
2553
|
-
return
|
2554
|
-
};
|
2582
|
+
return ToArrayObservable;
|
2583
|
+
}(ObservableBase));
|
2555
2584
|
|
2556
2585
|
/**
|
2557
2586
|
* Creates an array from an observable sequence.
|
@@ -2570,7 +2599,7 @@
|
|
2570
2599
|
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
|
2571
2600
|
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
|
2572
2601
|
*/
|
2573
|
-
Observable.create =
|
2602
|
+
Observable.create = function (subscribe, parent) {
|
2574
2603
|
return new AnonymousObservable(subscribe, parent);
|
2575
2604
|
};
|
2576
2605
|
|
@@ -2603,26 +2632,29 @@
|
|
2603
2632
|
}
|
2604
2633
|
|
2605
2634
|
EmptyObservable.prototype.subscribeCore = function (observer) {
|
2606
|
-
var sink = new EmptySink(observer, this);
|
2635
|
+
var sink = new EmptySink(observer, this.scheduler);
|
2607
2636
|
return sink.run();
|
2608
2637
|
};
|
2609
2638
|
|
2610
|
-
function EmptySink(observer,
|
2639
|
+
function EmptySink(observer, scheduler) {
|
2611
2640
|
this.observer = observer;
|
2612
|
-
this.
|
2641
|
+
this.scheduler = scheduler;
|
2613
2642
|
}
|
2614
2643
|
|
2615
2644
|
function scheduleItem(s, state) {
|
2616
2645
|
state.onCompleted();
|
2646
|
+
return disposableEmpty;
|
2617
2647
|
}
|
2618
2648
|
|
2619
2649
|
EmptySink.prototype.run = function () {
|
2620
|
-
return this.
|
2650
|
+
return this.scheduler.scheduleWithState(this.observer, scheduleItem);
|
2621
2651
|
};
|
2622
2652
|
|
2623
2653
|
return EmptyObservable;
|
2624
2654
|
}(ObservableBase));
|
2625
2655
|
|
2656
|
+
var EMPTY_OBSERVABLE = new EmptyObservable(immediateScheduler);
|
2657
|
+
|
2626
2658
|
/**
|
2627
2659
|
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
|
2628
2660
|
*
|
@@ -2634,7 +2666,7 @@
|
|
2634
2666
|
*/
|
2635
2667
|
var observableEmpty = Observable.empty = function (scheduler) {
|
2636
2668
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
2637
|
-
return new EmptyObservable(scheduler);
|
2669
|
+
return scheduler === immediateScheduler ? EMPTY_OBSERVABLE : new EmptyObservable(scheduler);
|
2638
2670
|
};
|
2639
2671
|
|
2640
2672
|
var FromObservable = (function(__super__) {
|
@@ -2646,8 +2678,8 @@
|
|
2646
2678
|
__super__.call(this);
|
2647
2679
|
}
|
2648
2680
|
|
2649
|
-
FromObservable.prototype.subscribeCore = function (
|
2650
|
-
var sink = new FromSink(
|
2681
|
+
FromObservable.prototype.subscribeCore = function (o) {
|
2682
|
+
var sink = new FromSink(o, this);
|
2651
2683
|
return sink.run();
|
2652
2684
|
};
|
2653
2685
|
|
@@ -2655,38 +2687,30 @@
|
|
2655
2687
|
}(ObservableBase));
|
2656
2688
|
|
2657
2689
|
var FromSink = (function () {
|
2658
|
-
function FromSink(
|
2659
|
-
this.
|
2690
|
+
function FromSink(o, parent) {
|
2691
|
+
this.o = o;
|
2660
2692
|
this.parent = parent;
|
2661
2693
|
}
|
2662
2694
|
|
2663
2695
|
FromSink.prototype.run = function () {
|
2664
2696
|
var list = Object(this.parent.iterable),
|
2665
2697
|
it = getIterable(list),
|
2666
|
-
|
2698
|
+
o = this.o,
|
2667
2699
|
mapper = this.parent.mapper;
|
2668
2700
|
|
2669
2701
|
function loopRecursive(i, recurse) {
|
2670
|
-
|
2671
|
-
|
2672
|
-
|
2673
|
-
return observer.onError(e);
|
2674
|
-
}
|
2675
|
-
if (next.done) {
|
2676
|
-
return observer.onCompleted();
|
2677
|
-
}
|
2702
|
+
var next = tryCatch(it.next).call(it);
|
2703
|
+
if (next === errorObj) { return o.onError(next.e); }
|
2704
|
+
if (next.done) { return o.onCompleted(); }
|
2678
2705
|
|
2679
2706
|
var result = next.value;
|
2680
2707
|
|
2681
|
-
if (mapper) {
|
2682
|
-
|
2683
|
-
|
2684
|
-
} catch (e) {
|
2685
|
-
return observer.onError(e);
|
2686
|
-
}
|
2708
|
+
if (isFunction(mapper)) {
|
2709
|
+
result = tryCatch(mapper)(result, i);
|
2710
|
+
if (result === errorObj) { return o.onError(result.e); }
|
2687
2711
|
}
|
2688
2712
|
|
2689
|
-
|
2713
|
+
o.onNext(result);
|
2690
2714
|
recurse(i + 1);
|
2691
2715
|
}
|
2692
2716
|
|
@@ -2698,7 +2722,7 @@
|
|
2698
2722
|
|
2699
2723
|
var maxSafeInteger = Math.pow(2, 53) - 1;
|
2700
2724
|
|
2701
|
-
function StringIterable(
|
2725
|
+
function StringIterable(s) {
|
2702
2726
|
this._s = s;
|
2703
2727
|
}
|
2704
2728
|
|
@@ -2706,7 +2730,7 @@
|
|
2706
2730
|
return new StringIterator(this._s);
|
2707
2731
|
};
|
2708
2732
|
|
2709
|
-
function StringIterator(
|
2733
|
+
function StringIterator(s) {
|
2710
2734
|
this._s = s;
|
2711
2735
|
this._l = s.length;
|
2712
2736
|
this._i = 0;
|
@@ -2901,12 +2925,14 @@
|
|
2901
2925
|
return NeverObservable;
|
2902
2926
|
}(ObservableBase));
|
2903
2927
|
|
2928
|
+
var NEVER_OBSERVABLE = new NeverObservable();
|
2929
|
+
|
2904
2930
|
/**
|
2905
2931
|
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
|
2906
2932
|
* @returns {Observable} An observable sequence whose observers will never get called.
|
2907
2933
|
*/
|
2908
2934
|
var observableNever = Observable.never = function () {
|
2909
|
-
return
|
2935
|
+
return NEVER_OBSERVABLE;
|
2910
2936
|
};
|
2911
2937
|
|
2912
2938
|
function observableOf (scheduler, array) {
|
@@ -2987,7 +3013,7 @@
|
|
2987
3013
|
inherits(RangeObservable, __super__);
|
2988
3014
|
function RangeObservable(start, count, scheduler) {
|
2989
3015
|
this.start = start;
|
2990
|
-
this.
|
3016
|
+
this.rangeCount = count;
|
2991
3017
|
this.scheduler = scheduler;
|
2992
3018
|
__super__.call(this);
|
2993
3019
|
}
|
@@ -3007,7 +3033,7 @@
|
|
3007
3033
|
}
|
3008
3034
|
|
3009
3035
|
RangeSink.prototype.run = function () {
|
3010
|
-
var start = this.parent.start, count = this.parent.
|
3036
|
+
var start = this.parent.start, count = this.parent.rangeCount, observer = this.observer;
|
3011
3037
|
function loopRecursive(i, recurse) {
|
3012
3038
|
if (i < count) {
|
3013
3039
|
observer.onNext(start + i);
|
@@ -3092,23 +3118,28 @@
|
|
3092
3118
|
}
|
3093
3119
|
|
3094
3120
|
JustObservable.prototype.subscribeCore = function (observer) {
|
3095
|
-
var sink = new JustSink(observer, this);
|
3121
|
+
var sink = new JustSink(observer, this.value, this.scheduler);
|
3096
3122
|
return sink.run();
|
3097
3123
|
};
|
3098
3124
|
|
3099
|
-
function JustSink(observer,
|
3125
|
+
function JustSink(observer, value, scheduler) {
|
3100
3126
|
this.observer = observer;
|
3101
|
-
this.
|
3127
|
+
this.value = value;
|
3128
|
+
this.scheduler = scheduler;
|
3102
3129
|
}
|
3103
3130
|
|
3104
3131
|
function scheduleItem(s, state) {
|
3105
3132
|
var value = state[0], observer = state[1];
|
3106
3133
|
observer.onNext(value);
|
3107
3134
|
observer.onCompleted();
|
3135
|
+
return disposableEmpty;
|
3108
3136
|
}
|
3109
3137
|
|
3110
3138
|
JustSink.prototype.run = function () {
|
3111
|
-
|
3139
|
+
var state = [this.value, this.observer];
|
3140
|
+
return this.scheduler === immediateScheduler ?
|
3141
|
+
scheduleItem(null, state) :
|
3142
|
+
this.scheduler.scheduleWithState(state, scheduleItem);
|
3112
3143
|
};
|
3113
3144
|
|
3114
3145
|
return JustObservable;
|
@@ -3121,7 +3152,7 @@
|
|
3121
3152
|
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
|
3122
3153
|
* @returns {Observable} An observable sequence containing the single specified element.
|
3123
3154
|
*/
|
3124
|
-
var observableReturn = Observable['return'] = Observable.just =
|
3155
|
+
var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {
|
3125
3156
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
3126
3157
|
return new JustObservable(value, scheduler);
|
3127
3158
|
};
|
@@ -3134,23 +3165,23 @@
|
|
3134
3165
|
__super__.call(this);
|
3135
3166
|
}
|
3136
3167
|
|
3137
|
-
ThrowObservable.prototype.subscribeCore = function (
|
3138
|
-
var sink = new ThrowSink(
|
3168
|
+
ThrowObservable.prototype.subscribeCore = function (o) {
|
3169
|
+
var sink = new ThrowSink(o, this);
|
3139
3170
|
return sink.run();
|
3140
3171
|
};
|
3141
3172
|
|
3142
|
-
function ThrowSink(
|
3143
|
-
this.
|
3144
|
-
this.
|
3173
|
+
function ThrowSink(o, p) {
|
3174
|
+
this.o = o;
|
3175
|
+
this.p = p;
|
3145
3176
|
}
|
3146
3177
|
|
3147
3178
|
function scheduleItem(s, state) {
|
3148
|
-
var
|
3149
|
-
|
3179
|
+
var e = state[0], o = state[1];
|
3180
|
+
o.onError(e);
|
3150
3181
|
}
|
3151
3182
|
|
3152
3183
|
ThrowSink.prototype.run = function () {
|
3153
|
-
return this.
|
3184
|
+
return this.p.scheduler.scheduleWithState([this.p.error, this.o], scheduleItem);
|
3154
3185
|
};
|
3155
3186
|
|
3156
3187
|
return ThrowObservable;
|
@@ -3163,7 +3194,7 @@
|
|
3163
3194
|
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
|
3164
3195
|
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
|
3165
3196
|
*/
|
3166
|
-
var observableThrow = Observable['throw'] =
|
3197
|
+
var observableThrow = Observable['throw'] = function (error, scheduler) {
|
3167
3198
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
3168
3199
|
return new ThrowObservable(error, scheduler);
|
3169
3200
|
};
|
@@ -3175,16 +3206,18 @@
|
|
3175
3206
|
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
|
3176
3207
|
*/
|
3177
3208
|
Observable.using = function (resourceFactory, observableFactory) {
|
3178
|
-
return new AnonymousObservable(function (
|
3179
|
-
var disposable = disposableEmpty
|
3180
|
-
|
3181
|
-
|
3182
|
-
|
3183
|
-
|
3184
|
-
|
3185
|
-
|
3209
|
+
return new AnonymousObservable(function (o) {
|
3210
|
+
var disposable = disposableEmpty;
|
3211
|
+
var resource = tryCatch(resourceFactory)();
|
3212
|
+
if (resource === errorObj) {
|
3213
|
+
return new CompositeDisposable(observableThrow(resource.e).subscribe(o), disposable);
|
3214
|
+
}
|
3215
|
+
resource && (disposable = resource);
|
3216
|
+
var source = tryCatch(observableFactory)(resource);
|
3217
|
+
if (source === errorObj) {
|
3218
|
+
return new CompositeDisposable(observableThrow(source.e).subscribe(o), disposable);
|
3186
3219
|
}
|
3187
|
-
return new CompositeDisposable(source.subscribe(
|
3220
|
+
return new CompositeDisposable(source.subscribe(o), disposable);
|
3188
3221
|
});
|
3189
3222
|
};
|
3190
3223
|
|
@@ -3217,101 +3250,103 @@
|
|
3217
3250
|
}
|
3218
3251
|
}
|
3219
3252
|
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
observer.onNext(left);
|
3224
|
-
}
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3230
|
-
|
3231
|
-
|
3232
|
-
if (choice === leftChoice) {
|
3233
|
-
observer.onCompleted();
|
3234
|
-
}
|
3235
|
-
}));
|
3236
|
-
|
3237
|
-
rightSubscription.setDisposable(rightSource.subscribe(function (right) {
|
3238
|
-
choiceR();
|
3239
|
-
if (choice === rightChoice) {
|
3240
|
-
observer.onNext(right);
|
3241
|
-
}
|
3242
|
-
}, function (err) {
|
3243
|
-
choiceR();
|
3244
|
-
if (choice === rightChoice) {
|
3245
|
-
observer.onError(err);
|
3253
|
+
var leftSubscribe = observerCreate(
|
3254
|
+
function (left) {
|
3255
|
+
choiceL();
|
3256
|
+
choice === leftChoice && observer.onNext(left);
|
3257
|
+
},
|
3258
|
+
function (e) {
|
3259
|
+
choiceL();
|
3260
|
+
choice === leftChoice && observer.onError(e);
|
3261
|
+
},
|
3262
|
+
function () {
|
3263
|
+
choiceL();
|
3264
|
+
choice === leftChoice && observer.onCompleted();
|
3246
3265
|
}
|
3247
|
-
|
3248
|
-
|
3249
|
-
|
3250
|
-
|
3266
|
+
);
|
3267
|
+
var rightSubscribe = observerCreate(
|
3268
|
+
function (right) {
|
3269
|
+
choiceR();
|
3270
|
+
choice === rightChoice && observer.onNext(right);
|
3271
|
+
},
|
3272
|
+
function (e) {
|
3273
|
+
choiceR();
|
3274
|
+
choice === rightChoice && observer.onError(e);
|
3275
|
+
},
|
3276
|
+
function () {
|
3277
|
+
choiceR();
|
3278
|
+
choice === rightChoice && observer.onCompleted();
|
3251
3279
|
}
|
3252
|
-
|
3280
|
+
);
|
3281
|
+
|
3282
|
+
leftSubscription.setDisposable(leftSource.subscribe(leftSubscribe));
|
3283
|
+
rightSubscription.setDisposable(rightSource.subscribe(rightSubscribe));
|
3253
3284
|
|
3254
3285
|
return new CompositeDisposable(leftSubscription, rightSubscription);
|
3255
3286
|
});
|
3256
3287
|
};
|
3257
3288
|
|
3289
|
+
function amb(p, c) { return p.amb(c); }
|
3290
|
+
|
3258
3291
|
/**
|
3259
3292
|
* Propagates the observable sequence or Promise that reacts first.
|
3260
|
-
*
|
3261
|
-
* @example
|
3262
|
-
* var = Rx.Observable.amb(xs, ys, zs);
|
3263
3293
|
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
|
3264
3294
|
*/
|
3265
3295
|
Observable.amb = function () {
|
3266
|
-
var acc = observableNever(), items
|
3296
|
+
var acc = observableNever(), items;
|
3267
3297
|
if (Array.isArray(arguments[0])) {
|
3268
3298
|
items = arguments[0];
|
3269
3299
|
} else {
|
3270
|
-
|
3271
|
-
|
3272
|
-
|
3273
|
-
function func(previous, current) {
|
3274
|
-
return previous.amb(current);
|
3300
|
+
var len = arguments.length;
|
3301
|
+
items = new Array(items);
|
3302
|
+
for(var i = 0; i < len; i++) { items[i] = arguments[i]; }
|
3275
3303
|
}
|
3276
3304
|
for (var i = 0, len = items.length; i < len; i++) {
|
3277
|
-
acc =
|
3305
|
+
acc = amb(acc, items[i]);
|
3278
3306
|
}
|
3279
3307
|
return acc;
|
3280
3308
|
};
|
3281
3309
|
|
3310
|
+
var CatchObserver = (function(__super__) {
|
3311
|
+
inherits(CatchObserver, __super__);
|
3312
|
+
function CatchObserver(o, s, fn) {
|
3313
|
+
this._o = o;
|
3314
|
+
this._s = s;
|
3315
|
+
this._fn = fn;
|
3316
|
+
__super__.call(this);
|
3317
|
+
}
|
3318
|
+
|
3319
|
+
CatchObserver.prototype.next = function (x) { this._o.onNext(x); };
|
3320
|
+
CatchObserver.prototype.completed = function () { return this._o.onCompleted(); };
|
3321
|
+
CatchObserver.prototype.error = function (e) {
|
3322
|
+
var result = tryCatch(this._fn)(e);
|
3323
|
+
if (result === errorObj) { return this._o.onError(result.e); }
|
3324
|
+
isPromise(result) && (result = observableFromPromise(result));
|
3325
|
+
|
3326
|
+
var d = new SingleAssignmentDisposable();
|
3327
|
+
this._s.setDisposable(d);
|
3328
|
+
d.setDisposable(result.subscribe(this._o));
|
3329
|
+
};
|
3330
|
+
|
3331
|
+
return CatchObserver;
|
3332
|
+
}(AbstractObserver));
|
3333
|
+
|
3282
3334
|
function observableCatchHandler(source, handler) {
|
3283
3335
|
return new AnonymousObservable(function (o) {
|
3284
3336
|
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
|
3285
3337
|
subscription.setDisposable(d1);
|
3286
|
-
d1.setDisposable(source.subscribe(
|
3287
|
-
try {
|
3288
|
-
var result = handler(e);
|
3289
|
-
} catch (ex) {
|
3290
|
-
return o.onError(ex);
|
3291
|
-
}
|
3292
|
-
isPromise(result) && (result = observableFromPromise(result));
|
3293
|
-
|
3294
|
-
var d = new SingleAssignmentDisposable();
|
3295
|
-
subscription.setDisposable(d);
|
3296
|
-
d.setDisposable(result.subscribe(o));
|
3297
|
-
}, function (x) { o.onCompleted(x); }));
|
3298
|
-
|
3338
|
+
d1.setDisposable(source.subscribe(new CatchObserver(o, subscription, handler)));
|
3299
3339
|
return subscription;
|
3300
3340
|
}, source);
|
3301
3341
|
}
|
3302
3342
|
|
3303
3343
|
/**
|
3304
3344
|
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
|
3305
|
-
* @example
|
3306
|
-
* 1 - xs.catchException(ys)
|
3307
|
-
* 2 - xs.catchException(function (ex) { return ys(ex); })
|
3308
3345
|
* @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.
|
3309
3346
|
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
|
3310
3347
|
*/
|
3311
|
-
observableProto['catch'] =
|
3312
|
-
return
|
3313
|
-
observableCatchHandler(this, handlerOrSecond) :
|
3314
|
-
observableCatch([this, handlerOrSecond]);
|
3348
|
+
observableProto['catch'] = function (handlerOrSecond) {
|
3349
|
+
return isFunction(handlerOrSecond) ? observableCatchHandler(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]);
|
3315
3350
|
};
|
3316
3351
|
|
3317
3352
|
/**
|
@@ -3319,12 +3354,14 @@
|
|
3319
3354
|
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
|
3320
3355
|
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
|
3321
3356
|
*/
|
3322
|
-
var observableCatch = Observable
|
3323
|
-
var items
|
3357
|
+
var observableCatch = Observable['catch'] = function () {
|
3358
|
+
var items;
|
3324
3359
|
if (Array.isArray(arguments[0])) {
|
3325
3360
|
items = arguments[0];
|
3326
3361
|
} else {
|
3327
|
-
|
3362
|
+
var len = arguments.length;
|
3363
|
+
items = new Array(len);
|
3364
|
+
for(var i = 0; i < len; i++) { items[i] = arguments[i]; }
|
3328
3365
|
}
|
3329
3366
|
return enumerableOf(items).catchError();
|
3330
3367
|
};
|
@@ -3349,6 +3386,13 @@
|
|
3349
3386
|
return combineLatest.apply(this, args);
|
3350
3387
|
};
|
3351
3388
|
|
3389
|
+
function falseFactory() { return false; }
|
3390
|
+
function argumentsToArray() {
|
3391
|
+
var len = arguments.length, args = new Array(len);
|
3392
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
3393
|
+
return args;
|
3394
|
+
}
|
3395
|
+
|
3352
3396
|
/**
|
3353
3397
|
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
|
3354
3398
|
*
|
@@ -3360,12 +3404,11 @@
|
|
3360
3404
|
var combineLatest = Observable.combineLatest = function () {
|
3361
3405
|
var len = arguments.length, args = new Array(len);
|
3362
3406
|
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
3363
|
-
var resultSelector = args.pop();
|
3407
|
+
var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;
|
3364
3408
|
Array.isArray(args[0]) && (args = args[0]);
|
3365
3409
|
|
3366
3410
|
return new AnonymousObservable(function (o) {
|
3367
3411
|
var n = args.length,
|
3368
|
-
falseFactory = function () { return false; },
|
3369
3412
|
hasValue = arrayInitialize(n, falseFactory),
|
3370
3413
|
hasValueAll = false,
|
3371
3414
|
isDone = arrayInitialize(n, falseFactory),
|
@@ -3420,6 +3463,52 @@
|
|
3420
3463
|
return observableConcat.apply(null, args);
|
3421
3464
|
};
|
3422
3465
|
|
3466
|
+
var ConcatObservable = (function(__super__) {
|
3467
|
+
inherits(ConcatObservable, __super__);
|
3468
|
+
function ConcatObservable(sources) {
|
3469
|
+
this.sources = sources;
|
3470
|
+
__super__.call(this);
|
3471
|
+
}
|
3472
|
+
|
3473
|
+
ConcatObservable.prototype.subscribeCore = function(o) {
|
3474
|
+
var sink = new ConcatSink(this.sources, o);
|
3475
|
+
return sink.run();
|
3476
|
+
};
|
3477
|
+
|
3478
|
+
function ConcatSink(sources, o) {
|
3479
|
+
this.sources = sources;
|
3480
|
+
this.o = o;
|
3481
|
+
}
|
3482
|
+
ConcatSink.prototype.run = function () {
|
3483
|
+
var isDisposed, subscription = new SerialDisposable(), sources = this.sources, length = sources.length, o = this.o;
|
3484
|
+
var cancelable = immediateScheduler.scheduleRecursiveWithState(0, function (i, self) {
|
3485
|
+
if (isDisposed) { return; }
|
3486
|
+
if (i === length) {
|
3487
|
+
return o.onCompleted();
|
3488
|
+
}
|
3489
|
+
|
3490
|
+
// Check if promise
|
3491
|
+
var currentValue = sources[i];
|
3492
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
3493
|
+
|
3494
|
+
var d = new SingleAssignmentDisposable();
|
3495
|
+
subscription.setDisposable(d);
|
3496
|
+
d.setDisposable(currentValue.subscribe(
|
3497
|
+
function (x) { o.onNext(x); },
|
3498
|
+
function (e) { o.onError(e); },
|
3499
|
+
function () { self(i + 1); }
|
3500
|
+
));
|
3501
|
+
});
|
3502
|
+
|
3503
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
3504
|
+
isDisposed = true;
|
3505
|
+
}));
|
3506
|
+
};
|
3507
|
+
|
3508
|
+
|
3509
|
+
return ConcatObservable;
|
3510
|
+
}(ObservableBase));
|
3511
|
+
|
3423
3512
|
/**
|
3424
3513
|
* Concatenates all the observable sequences.
|
3425
3514
|
* @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.
|
@@ -3433,14 +3522,14 @@
|
|
3433
3522
|
args = new Array(arguments.length);
|
3434
3523
|
for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; }
|
3435
3524
|
}
|
3436
|
-
return
|
3525
|
+
return new ConcatObservable(args);
|
3437
3526
|
};
|
3438
3527
|
|
3439
3528
|
/**
|
3440
3529
|
* Concatenates an observable sequence of observable sequences.
|
3441
3530
|
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
|
3442
3531
|
*/
|
3443
|
-
observableProto.concatAll =
|
3532
|
+
observableProto.concatAll = function () {
|
3444
3533
|
return this.merge(1);
|
3445
3534
|
};
|
3446
3535
|
|
@@ -3609,11 +3698,6 @@
|
|
3609
3698
|
return g;
|
3610
3699
|
};
|
3611
3700
|
|
3612
|
-
return MergeAllObservable;
|
3613
|
-
}(ObservableBase));
|
3614
|
-
|
3615
|
-
var MergeAllObserver = (function() {
|
3616
|
-
|
3617
3701
|
function MergeAllObserver(o, g) {
|
3618
3702
|
this.o = o;
|
3619
3703
|
this.g = g;
|
@@ -3627,7 +3711,7 @@
|
|
3627
3711
|
|
3628
3712
|
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
3629
3713
|
|
3630
|
-
sad.setDisposable(innerSource.subscribe(new InnerObserver(this,
|
3714
|
+
sad.setDisposable(innerSource.subscribe(new InnerObserver(this, sad)));
|
3631
3715
|
};
|
3632
3716
|
MergeAllObserver.prototype.onError = function (e) {
|
3633
3717
|
if(!this.isStopped) {
|
@@ -3653,9 +3737,8 @@
|
|
3653
3737
|
return false;
|
3654
3738
|
};
|
3655
3739
|
|
3656
|
-
function InnerObserver(parent,
|
3740
|
+
function InnerObserver(parent, sad) {
|
3657
3741
|
this.parent = parent;
|
3658
|
-
this.g = g;
|
3659
3742
|
this.sad = sad;
|
3660
3743
|
this.isStopped = false;
|
3661
3744
|
}
|
@@ -3685,15 +3768,14 @@
|
|
3685
3768
|
return false;
|
3686
3769
|
};
|
3687
3770
|
|
3688
|
-
return
|
3689
|
-
|
3690
|
-
}());
|
3771
|
+
return MergeAllObservable;
|
3772
|
+
}(ObservableBase));
|
3691
3773
|
|
3692
3774
|
/**
|
3693
3775
|
* Merges an observable sequence of observable sequences into an observable sequence.
|
3694
3776
|
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
|
3695
3777
|
*/
|
3696
|
-
observableProto.mergeAll =
|
3778
|
+
observableProto.mergeAll = function () {
|
3697
3779
|
return new MergeAllObservable(this);
|
3698
3780
|
};
|
3699
3781
|
|
@@ -3851,87 +3933,171 @@
|
|
3851
3933
|
}, source);
|
3852
3934
|
};
|
3853
3935
|
|
3936
|
+
var SwitchObservable = (function(__super__) {
|
3937
|
+
inherits(SwitchObservable, __super__);
|
3938
|
+
function SwitchObservable(source) {
|
3939
|
+
this.source = source;
|
3940
|
+
__super__.call(this);
|
3941
|
+
}
|
3942
|
+
|
3943
|
+
SwitchObservable.prototype.subscribeCore = function (o) {
|
3944
|
+
var inner = new SerialDisposable(), s = this.source.subscribe(new SwitchObserver(o, inner));
|
3945
|
+
return new CompositeDisposable(s, inner);
|
3946
|
+
};
|
3947
|
+
|
3948
|
+
function SwitchObserver(o, inner) {
|
3949
|
+
this.o = o;
|
3950
|
+
this.inner = inner;
|
3951
|
+
this.stopped = false;
|
3952
|
+
this.latest = 0;
|
3953
|
+
this.hasLatest = false;
|
3954
|
+
this.isStopped = false;
|
3955
|
+
}
|
3956
|
+
SwitchObserver.prototype.onNext = function (innerSource) {
|
3957
|
+
if (this.isStopped) { return; }
|
3958
|
+
var d = new SingleAssignmentDisposable(), id = ++this.latest;
|
3959
|
+
this.hasLatest = true;
|
3960
|
+
this.inner.setDisposable(d);
|
3961
|
+
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
3962
|
+
d.setDisposable(innerSource.subscribe(new InnerObserver(this, id)));
|
3963
|
+
};
|
3964
|
+
SwitchObserver.prototype.onError = function (e) {
|
3965
|
+
if (!this.isStopped) {
|
3966
|
+
this.isStopped = true;
|
3967
|
+
this.o.onError(e);
|
3968
|
+
}
|
3969
|
+
};
|
3970
|
+
SwitchObserver.prototype.onCompleted = function () {
|
3971
|
+
if (!this.isStopped) {
|
3972
|
+
this.isStopped = true;
|
3973
|
+
this.stopped = true;
|
3974
|
+
!this.hasLatest && this.o.onCompleted();
|
3975
|
+
}
|
3976
|
+
};
|
3977
|
+
SwitchObserver.prototype.dispose = function () { this.isStopped = true; };
|
3978
|
+
SwitchObserver.prototype.fail = function (e) {
|
3979
|
+
if(!this.isStopped) {
|
3980
|
+
this.isStopped = true;
|
3981
|
+
this.o.onError(e);
|
3982
|
+
return true;
|
3983
|
+
}
|
3984
|
+
return false;
|
3985
|
+
};
|
3986
|
+
|
3987
|
+
function InnerObserver(parent, id) {
|
3988
|
+
this.parent = parent;
|
3989
|
+
this.id = id;
|
3990
|
+
this.isStopped = false;
|
3991
|
+
}
|
3992
|
+
InnerObserver.prototype.onNext = function (x) {
|
3993
|
+
if (this.isStopped) { return; }
|
3994
|
+
this.parent.latest === this.id && this.parent.o.onNext(x);
|
3995
|
+
};
|
3996
|
+
InnerObserver.prototype.onError = function (e) {
|
3997
|
+
if (!this.isStopped) {
|
3998
|
+
this.isStopped = true;
|
3999
|
+
this.parent.latest === this.id && this.parent.o.onError(e);
|
4000
|
+
}
|
4001
|
+
};
|
4002
|
+
InnerObserver.prototype.onCompleted = function () {
|
4003
|
+
if (!this.isStopped) {
|
4004
|
+
this.isStopped = true;
|
4005
|
+
if (this.parent.latest === this.id) {
|
4006
|
+
this.parent.hasLatest = false;
|
4007
|
+
this.parent.isStopped && this.parent.o.onCompleted();
|
4008
|
+
}
|
4009
|
+
}
|
4010
|
+
};
|
4011
|
+
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
|
4012
|
+
InnerObserver.prototype.fail = function (e) {
|
4013
|
+
if(!this.isStopped) {
|
4014
|
+
this.isStopped = true;
|
4015
|
+
this.parent.o.onError(e);
|
4016
|
+
return true;
|
4017
|
+
}
|
4018
|
+
return false;
|
4019
|
+
};
|
4020
|
+
|
4021
|
+
return SwitchObservable;
|
4022
|
+
}(ObservableBase));
|
4023
|
+
|
3854
4024
|
/**
|
3855
|
-
|
3856
|
-
|
3857
|
-
|
4025
|
+
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
|
4026
|
+
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
4027
|
+
*/
|
3858
4028
|
observableProto['switch'] = observableProto.switchLatest = function () {
|
3859
|
-
|
3860
|
-
return new AnonymousObservable(function (observer) {
|
3861
|
-
var hasLatest = false,
|
3862
|
-
innerSubscription = new SerialDisposable(),
|
3863
|
-
isStopped = false,
|
3864
|
-
latest = 0,
|
3865
|
-
subscription = sources.subscribe(
|
3866
|
-
function (innerSource) {
|
3867
|
-
var d = new SingleAssignmentDisposable(), id = ++latest;
|
3868
|
-
hasLatest = true;
|
3869
|
-
innerSubscription.setDisposable(d);
|
3870
|
-
|
3871
|
-
// Check if Promise or Observable
|
3872
|
-
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
3873
|
-
|
3874
|
-
d.setDisposable(innerSource.subscribe(
|
3875
|
-
function (x) { latest === id && observer.onNext(x); },
|
3876
|
-
function (e) { latest === id && observer.onError(e); },
|
3877
|
-
function () {
|
3878
|
-
if (latest === id) {
|
3879
|
-
hasLatest = false;
|
3880
|
-
isStopped && observer.onCompleted();
|
3881
|
-
}
|
3882
|
-
}));
|
3883
|
-
},
|
3884
|
-
function (e) { observer.onError(e); },
|
3885
|
-
function () {
|
3886
|
-
isStopped = true;
|
3887
|
-
!hasLatest && observer.onCompleted();
|
3888
|
-
});
|
3889
|
-
return new CompositeDisposable(subscription, innerSubscription);
|
3890
|
-
}, sources);
|
4029
|
+
return new SwitchObservable(this);
|
3891
4030
|
};
|
3892
4031
|
|
4032
|
+
var TakeUntilObservable = (function(__super__) {
|
4033
|
+
inherits(TakeUntilObservable, __super__);
|
4034
|
+
|
4035
|
+
function TakeUntilObservable(source, other) {
|
4036
|
+
this.source = source;
|
4037
|
+
this.other = isPromise(other) ? observableFromPromise(other) : other;
|
4038
|
+
__super__.call(this);
|
4039
|
+
}
|
4040
|
+
|
4041
|
+
TakeUntilObservable.prototype.subscribeCore = function(o) {
|
4042
|
+
return new CompositeDisposable(
|
4043
|
+
this.source.subscribe(o),
|
4044
|
+
this.other.subscribe(new InnerObserver(o))
|
4045
|
+
);
|
4046
|
+
};
|
4047
|
+
|
4048
|
+
function InnerObserver(o) {
|
4049
|
+
this.o = o;
|
4050
|
+
this.isStopped = false;
|
4051
|
+
}
|
4052
|
+
InnerObserver.prototype.onNext = function (x) {
|
4053
|
+
if (this.isStopped) { return; }
|
4054
|
+
this.o.onCompleted();
|
4055
|
+
};
|
4056
|
+
InnerObserver.prototype.onError = function (err) {
|
4057
|
+
if (!this.isStopped) {
|
4058
|
+
this.isStopped = true;
|
4059
|
+
this.o.onError(err);
|
4060
|
+
}
|
4061
|
+
};
|
4062
|
+
InnerObserver.prototype.onCompleted = function () {
|
4063
|
+
!this.isStopped && (this.isStopped = true);
|
4064
|
+
};
|
4065
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
4066
|
+
InnerObserver.prototype.fail = function (e) {
|
4067
|
+
if (!this.isStopped) {
|
4068
|
+
this.isStopped = true;
|
4069
|
+
this.o.onError(e);
|
4070
|
+
return true;
|
4071
|
+
}
|
4072
|
+
return false;
|
4073
|
+
};
|
4074
|
+
|
4075
|
+
return TakeUntilObservable;
|
4076
|
+
}(ObservableBase));
|
4077
|
+
|
3893
4078
|
/**
|
3894
4079
|
* Returns the values from the source observable sequence until the other observable sequence produces a value.
|
3895
4080
|
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
|
3896
4081
|
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
|
3897
4082
|
*/
|
3898
4083
|
observableProto.takeUntil = function (other) {
|
3899
|
-
|
3900
|
-
return new AnonymousObservable(function (o) {
|
3901
|
-
isPromise(other) && (other = observableFromPromise(other));
|
3902
|
-
return new CompositeDisposable(
|
3903
|
-
source.subscribe(o),
|
3904
|
-
other.subscribe(function () { o.onCompleted(); }, function (e) { o.onError(e); }, noop)
|
3905
|
-
);
|
3906
|
-
}, source);
|
4084
|
+
return new TakeUntilObservable(this, other);
|
3907
4085
|
};
|
3908
4086
|
|
4087
|
+
function falseFactory() { return false; }
|
4088
|
+
|
3909
4089
|
/**
|
3910
4090
|
* Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element.
|
3911
|
-
*
|
3912
|
-
* @example
|
3913
|
-
* 1 - obs = obs1.withLatestFrom(obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
|
3914
|
-
* 2 - obs = obs1.withLatestFrom([obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
|
3915
4091
|
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
3916
4092
|
*/
|
3917
4093
|
observableProto.withLatestFrom = function () {
|
3918
4094
|
var len = arguments.length, args = new Array(len)
|
3919
4095
|
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
3920
4096
|
var resultSelector = args.pop(), source = this;
|
3921
|
-
|
3922
|
-
if (typeof source === 'undefined') {
|
3923
|
-
throw new Error('Source observable not found for withLatestFrom().');
|
3924
|
-
}
|
3925
|
-
if (typeof resultSelector !== 'function') {
|
3926
|
-
throw new Error('withLatestFrom() expects a resultSelector function.');
|
3927
|
-
}
|
3928
|
-
if (Array.isArray(args[0])) {
|
3929
|
-
args = args[0];
|
3930
|
-
}
|
4097
|
+
Array.isArray(args[0]) && (args = args[0]);
|
3931
4098
|
|
3932
4099
|
return new AnonymousObservable(function (observer) {
|
3933
|
-
var
|
3934
|
-
n = args.length,
|
4100
|
+
var n = args.length,
|
3935
4101
|
hasValue = arrayInitialize(n, falseFactory),
|
3936
4102
|
hasValueAll = false,
|
3937
4103
|
values = new Array(n);
|
@@ -3945,24 +4111,19 @@
|
|
3945
4111
|
values[i] = x;
|
3946
4112
|
hasValue[i] = true;
|
3947
4113
|
hasValueAll = hasValue.every(identity);
|
3948
|
-
},
|
4114
|
+
}, function (e) { observer.onError(e); }, noop));
|
3949
4115
|
subscriptions[i] = sad;
|
3950
4116
|
}(idx));
|
3951
4117
|
}
|
3952
4118
|
|
3953
4119
|
var sad = new SingleAssignmentDisposable();
|
3954
4120
|
sad.setDisposable(source.subscribe(function (x) {
|
3955
|
-
var res;
|
3956
4121
|
var allValues = [x].concat(values);
|
3957
|
-
if (!hasValueAll) return;
|
3958
|
-
|
3959
|
-
|
3960
|
-
} catch (ex) {
|
3961
|
-
observer.onError(ex);
|
3962
|
-
return;
|
3963
|
-
}
|
4122
|
+
if (!hasValueAll) { return; }
|
4123
|
+
var res = tryCatch(resultSelector).apply(null, allValues);
|
4124
|
+
if (res === errorObj) { return observer.onError(res.e); }
|
3964
4125
|
observer.onNext(res);
|
3965
|
-
}, observer.onError
|
4126
|
+
}, function (e) { observer.onError(e); }, function () {
|
3966
4127
|
observer.onCompleted();
|
3967
4128
|
}));
|
3968
4129
|
subscriptions[n] = sad;
|
@@ -3971,83 +4132,54 @@
|
|
3971
4132
|
}, this);
|
3972
4133
|
};
|
3973
4134
|
|
3974
|
-
function zipArray(second, resultSelector) {
|
3975
|
-
var first = this;
|
3976
|
-
return new AnonymousObservable(function (observer) {
|
3977
|
-
var index = 0, len = second.length;
|
3978
|
-
return first.subscribe(function (left) {
|
3979
|
-
if (index < len) {
|
3980
|
-
var right = second[index++], result;
|
3981
|
-
try {
|
3982
|
-
result = resultSelector(left, right);
|
3983
|
-
} catch (e) {
|
3984
|
-
return observer.onError(e);
|
3985
|
-
}
|
3986
|
-
observer.onNext(result);
|
3987
|
-
} else {
|
3988
|
-
observer.onCompleted();
|
3989
|
-
}
|
3990
|
-
}, function (e) { observer.onError(e); }, function () { observer.onCompleted(); });
|
3991
|
-
}, first);
|
3992
|
-
}
|
3993
|
-
|
3994
4135
|
function falseFactory() { return false; }
|
3995
4136
|
function emptyArrayFactory() { return []; }
|
4137
|
+
function argumentsToArray() {
|
4138
|
+
var len = arguments.length, args = new Array(len);
|
4139
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
4140
|
+
return args;
|
4141
|
+
}
|
3996
4142
|
|
3997
4143
|
/**
|
3998
4144
|
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
|
3999
4145
|
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.
|
4000
|
-
*
|
4001
|
-
* @example
|
4002
|
-
* 1 - res = obs1.zip(obs2, fn);
|
4003
|
-
* 1 - res = x1.zip([1,2,3], fn);
|
4004
4146
|
* @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.
|
4005
4147
|
*/
|
4006
4148
|
observableProto.zip = function () {
|
4007
|
-
if (
|
4149
|
+
if (arguments.length === 0) { throw new Error('invalid arguments'); }
|
4150
|
+
|
4008
4151
|
var len = arguments.length, args = new Array(len);
|
4009
4152
|
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
4153
|
+
var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;
|
4154
|
+
Array.isArray(args[0]) && (args = args[0]);
|
4010
4155
|
|
4011
|
-
var parent = this
|
4156
|
+
var parent = this;
|
4012
4157
|
args.unshift(parent);
|
4013
|
-
return new AnonymousObservable(function (
|
4158
|
+
return new AnonymousObservable(function (o) {
|
4014
4159
|
var n = args.length,
|
4015
4160
|
queues = arrayInitialize(n, emptyArrayFactory),
|
4016
4161
|
isDone = arrayInitialize(n, falseFactory);
|
4017
4162
|
|
4018
|
-
function next(i) {
|
4019
|
-
var res, queuedValues;
|
4020
|
-
if (queues.every(function (x) { return x.length > 0; })) {
|
4021
|
-
try {
|
4022
|
-
queuedValues = queues.map(function (x) { return x.shift(); });
|
4023
|
-
res = resultSelector.apply(parent, queuedValues);
|
4024
|
-
} catch (ex) {
|
4025
|
-
observer.onError(ex);
|
4026
|
-
return;
|
4027
|
-
}
|
4028
|
-
observer.onNext(res);
|
4029
|
-
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
4030
|
-
observer.onCompleted();
|
4031
|
-
}
|
4032
|
-
};
|
4033
|
-
|
4034
|
-
function done(i) {
|
4035
|
-
isDone[i] = true;
|
4036
|
-
if (isDone.every(function (x) { return x; })) {
|
4037
|
-
observer.onCompleted();
|
4038
|
-
}
|
4039
|
-
}
|
4040
|
-
|
4041
4163
|
var subscriptions = new Array(n);
|
4042
4164
|
for (var idx = 0; idx < n; idx++) {
|
4043
4165
|
(function (i) {
|
4044
4166
|
var source = args[i], sad = new SingleAssignmentDisposable();
|
4167
|
+
|
4045
4168
|
isPromise(source) && (source = observableFromPromise(source));
|
4169
|
+
|
4046
4170
|
sad.setDisposable(source.subscribe(function (x) {
|
4047
4171
|
queues[i].push(x);
|
4048
|
-
|
4049
|
-
|
4050
|
-
|
4172
|
+
if (queues.every(function (x) { return x.length > 0; })) {
|
4173
|
+
var queuedValues = queues.map(function (x) { return x.shift(); }),
|
4174
|
+
res = tryCatch(resultSelector).apply(parent, queuedValues);
|
4175
|
+
if (res === errorObj) { return o.onError(res.e); }
|
4176
|
+
o.onNext(res);
|
4177
|
+
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
4178
|
+
o.onCompleted();
|
4179
|
+
}
|
4180
|
+
}, function (e) { o.onError(e); }, function () {
|
4181
|
+
isDone[i] = true;
|
4182
|
+
isDone.every(identity) && o.onCompleted();
|
4051
4183
|
}));
|
4052
4184
|
subscriptions[i] = sad;
|
4053
4185
|
})(idx);
|
@@ -4070,88 +4202,88 @@
|
|
4070
4202
|
return first.zip.apply(first, args);
|
4071
4203
|
};
|
4072
4204
|
|
4073
|
-
|
4074
|
-
|
4075
|
-
|
4076
|
-
|
4077
|
-
|
4078
|
-
|
4079
|
-
|
4080
|
-
|
4081
|
-
|
4082
|
-
|
4083
|
-
|
4084
|
-
|
4085
|
-
|
4205
|
+
function falseFactory() { return false; }
|
4206
|
+
function emptyArrayFactory() { return []; }
|
4207
|
+
function argumentsToArray() {
|
4208
|
+
var len = arguments.length, args = new Array(len);
|
4209
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
4210
|
+
return args;
|
4211
|
+
}
|
4212
|
+
|
4213
|
+
/**
|
4214
|
+
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
|
4215
|
+
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.
|
4216
|
+
* @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.
|
4217
|
+
*/
|
4218
|
+
observableProto.zipIterable = function () {
|
4219
|
+
if (arguments.length === 0) { throw new Error('invalid arguments'); }
|
4220
|
+
|
4221
|
+
var len = arguments.length, args = new Array(len);
|
4222
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
4223
|
+
var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;
|
4224
|
+
|
4225
|
+
var parent = this;
|
4226
|
+
args.unshift(parent);
|
4227
|
+
return new AnonymousObservable(function (o) {
|
4228
|
+
var n = args.length,
|
4229
|
+
queues = arrayInitialize(n, emptyArrayFactory),
|
4230
|
+
isDone = arrayInitialize(n, falseFactory);
|
4231
|
+
|
4232
|
+
var subscriptions = new Array(n);
|
4233
|
+
for (var idx = 0; idx < n; idx++) {
|
4234
|
+
(function (i) {
|
4235
|
+
var source = args[i], sad = new SingleAssignmentDisposable();
|
4236
|
+
|
4237
|
+
(isArrayLike(source) || isIterable(source)) && (source = observableFrom(source));
|
4238
|
+
|
4239
|
+
sad.setDisposable(source.subscribe(function (x) {
|
4240
|
+
queues[i].push(x);
|
4241
|
+
if (queues.every(function (x) { return x.length > 0; })) {
|
4242
|
+
var queuedValues = queues.map(function (x) { return x.shift(); }),
|
4243
|
+
res = tryCatch(resultSelector).apply(parent, queuedValues);
|
4244
|
+
if (res === errorObj) { return o.onError(res.e); }
|
4245
|
+
o.onNext(res);
|
4246
|
+
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
4247
|
+
o.onCompleted();
|
4248
|
+
}
|
4249
|
+
}, function (e) { o.onError(e); }, function () {
|
4250
|
+
isDone[i] = true;
|
4251
|
+
isDone.every(identity) && o.onCompleted();
|
4252
|
+
}));
|
4253
|
+
subscriptions[i] = sad;
|
4254
|
+
})(idx);
|
4086
4255
|
}
|
4087
|
-
return new AnonymousObservable(function (observer) {
|
4088
|
-
var n = sources.length,
|
4089
|
-
queues = arrayInitialize(n, function () { return []; }),
|
4090
|
-
isDone = arrayInitialize(n, function () { return false; });
|
4091
4256
|
|
4092
|
-
|
4093
|
-
|
4094
|
-
|
4095
|
-
observer.onNext(res);
|
4096
|
-
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
4097
|
-
observer.onCompleted();
|
4098
|
-
return;
|
4099
|
-
}
|
4100
|
-
};
|
4257
|
+
return new CompositeDisposable(subscriptions);
|
4258
|
+
}, parent);
|
4259
|
+
};
|
4101
4260
|
|
4102
|
-
|
4103
|
-
|
4104
|
-
|
4105
|
-
observer.onCompleted();
|
4106
|
-
return;
|
4107
|
-
}
|
4108
|
-
}
|
4109
|
-
|
4110
|
-
var subscriptions = new Array(n);
|
4111
|
-
for (var idx = 0; idx < n; idx++) {
|
4112
|
-
(function (i) {
|
4113
|
-
subscriptions[i] = new SingleAssignmentDisposable();
|
4114
|
-
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
|
4115
|
-
queues[i].push(x);
|
4116
|
-
next(i);
|
4117
|
-
}, function (e) { observer.onError(e); }, function () {
|
4118
|
-
done(i);
|
4119
|
-
}));
|
4120
|
-
})(idx);
|
4121
|
-
}
|
4122
|
-
|
4123
|
-
return new CompositeDisposable(subscriptions);
|
4124
|
-
});
|
4125
|
-
};
|
4261
|
+
function asObservable(source) {
|
4262
|
+
return function subscribe(o) { return source.subscribe(o); };
|
4263
|
+
}
|
4126
4264
|
|
4127
4265
|
/**
|
4128
4266
|
* Hides the identity of an observable sequence.
|
4129
4267
|
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
|
4130
4268
|
*/
|
4131
4269
|
observableProto.asObservable = function () {
|
4132
|
-
|
4133
|
-
return new AnonymousObservable(function (o) { return source.subscribe(o); }, this);
|
4270
|
+
return new AnonymousObservable(asObservable(this), this);
|
4134
4271
|
};
|
4135
4272
|
|
4273
|
+
function toArray(x) { return x.toArray(); }
|
4274
|
+
function notEmpty(x) { return x.length > 0; }
|
4275
|
+
|
4136
4276
|
/**
|
4137
4277
|
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
|
4138
|
-
*
|
4139
|
-
* @example
|
4140
|
-
* var res = xs.bufferWithCount(10);
|
4141
|
-
* var res = xs.bufferWithCount(10, 1);
|
4142
4278
|
* @param {Number} count Length of each buffer.
|
4143
4279
|
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
|
4144
4280
|
* @returns {Observable} An observable sequence of buffers.
|
4145
4281
|
*/
|
4146
4282
|
observableProto.bufferWithCount = function (count, skip) {
|
4147
|
-
|
4148
|
-
|
4149
|
-
|
4150
|
-
|
4151
|
-
return x.toArray();
|
4152
|
-
}).where(function (x) {
|
4153
|
-
return x.length > 0;
|
4154
|
-
});
|
4283
|
+
typeof skip !== 'number' && (skip = count);
|
4284
|
+
return this.windowWithCount(count, skip)
|
4285
|
+
.flatMap(toArray)
|
4286
|
+
.filter(notEmpty);
|
4155
4287
|
};
|
4156
4288
|
|
4157
4289
|
/**
|
@@ -4165,118 +4297,167 @@
|
|
4165
4297
|
}, this);
|
4166
4298
|
};
|
4167
4299
|
|
4300
|
+
var DistinctUntilChangedObservable = (function(__super__) {
|
4301
|
+
inherits(DistinctUntilChangedObservable, __super__);
|
4302
|
+
function DistinctUntilChangedObservable(source, keyFn, comparer) {
|
4303
|
+
this.source = source;
|
4304
|
+
this.keyFn = keyFn;
|
4305
|
+
this.comparer = comparer;
|
4306
|
+
__super__.call(this);
|
4307
|
+
}
|
4308
|
+
|
4309
|
+
DistinctUntilChangedObservable.prototype.subscribeCore = function (o) {
|
4310
|
+
return this.source.subscribe(new DistinctUntilChangedObserver(o, this.keyFn, this.comparer));
|
4311
|
+
};
|
4312
|
+
|
4313
|
+
return DistinctUntilChangedObservable;
|
4314
|
+
}(ObservableBase));
|
4315
|
+
|
4316
|
+
var DistinctUntilChangedObserver = (function(__super__) {
|
4317
|
+
inherits(DistinctUntilChangedObserver, __super__);
|
4318
|
+
function DistinctUntilChangedObserver(o, keyFn, comparer) {
|
4319
|
+
this.o = o;
|
4320
|
+
this.keyFn = keyFn;
|
4321
|
+
this.comparer = comparer;
|
4322
|
+
this.hasCurrentKey = false;
|
4323
|
+
this.currentKey = null;
|
4324
|
+
__super__.call(this);
|
4325
|
+
}
|
4326
|
+
|
4327
|
+
DistinctUntilChangedObserver.prototype.next = function (x) {
|
4328
|
+
var key = x, comparerEquals;
|
4329
|
+
if (isFunction(this.keyFn)) {
|
4330
|
+
key = tryCatch(this.keyFn)(x);
|
4331
|
+
if (key === errorObj) { return this.o.onError(key.e); }
|
4332
|
+
}
|
4333
|
+
if (this.hasCurrentKey) {
|
4334
|
+
comparerEquals = tryCatch(this.comparer)(this.currentKey, key);
|
4335
|
+
if (comparerEquals === errorObj) { return this.o.onError(comparerEquals.e); }
|
4336
|
+
}
|
4337
|
+
if (!this.hasCurrentKey || !comparerEquals) {
|
4338
|
+
this.hasCurrentKey = true;
|
4339
|
+
this.currentKey = key;
|
4340
|
+
this.o.onNext(x);
|
4341
|
+
}
|
4342
|
+
};
|
4343
|
+
DistinctUntilChangedObserver.prototype.error = function(e) {
|
4344
|
+
this.o.onError(e);
|
4345
|
+
};
|
4346
|
+
DistinctUntilChangedObserver.prototype.completed = function () {
|
4347
|
+
this.o.onCompleted();
|
4348
|
+
};
|
4349
|
+
|
4350
|
+
return DistinctUntilChangedObserver;
|
4351
|
+
}(AbstractObserver));
|
4352
|
+
|
4168
4353
|
/**
|
4169
|
-
|
4170
|
-
|
4171
|
-
|
4172
|
-
|
4173
|
-
|
4174
|
-
|
4175
|
-
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
|
4176
|
-
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
|
4177
|
-
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
|
4178
|
-
*/
|
4179
|
-
observableProto.distinctUntilChanged = function (keySelector, comparer) {
|
4180
|
-
var source = this;
|
4354
|
+
* Returns an observable sequence that contains only distinct contiguous elements according to the keyFn and the comparer.
|
4355
|
+
* @param {Function} [keyFn] A function to compute the comparison key for each element. If not provided, it projects the value.
|
4356
|
+
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
|
4357
|
+
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
|
4358
|
+
*/
|
4359
|
+
observableProto.distinctUntilChanged = function (keyFn, comparer) {
|
4181
4360
|
comparer || (comparer = defaultComparer);
|
4182
|
-
return new
|
4183
|
-
var hasCurrentKey = false, currentKey;
|
4184
|
-
return source.subscribe(function (value) {
|
4185
|
-
var key = value;
|
4186
|
-
if (keySelector) {
|
4187
|
-
try {
|
4188
|
-
key = keySelector(value);
|
4189
|
-
} catch (e) {
|
4190
|
-
o.onError(e);
|
4191
|
-
return;
|
4192
|
-
}
|
4193
|
-
}
|
4194
|
-
if (hasCurrentKey) {
|
4195
|
-
try {
|
4196
|
-
var comparerEquals = comparer(currentKey, key);
|
4197
|
-
} catch (e) {
|
4198
|
-
o.onError(e);
|
4199
|
-
return;
|
4200
|
-
}
|
4201
|
-
}
|
4202
|
-
if (!hasCurrentKey || !comparerEquals) {
|
4203
|
-
hasCurrentKey = true;
|
4204
|
-
currentKey = key;
|
4205
|
-
o.onNext(value);
|
4206
|
-
}
|
4207
|
-
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
|
4208
|
-
}, this);
|
4361
|
+
return new DistinctUntilChangedObservable(this, keyFn, comparer);
|
4209
4362
|
};
|
4210
4363
|
|
4364
|
+
var TapObservable = (function(__super__) {
|
4365
|
+
inherits(TapObservable,__super__);
|
4366
|
+
function TapObservable(source, observerOrOnNext, onError, onCompleted) {
|
4367
|
+
this.source = source;
|
4368
|
+
this._oN = observerOrOnNext;
|
4369
|
+
this._oE = onError;
|
4370
|
+
this._oC = onCompleted;
|
4371
|
+
__super__.call(this);
|
4372
|
+
}
|
4373
|
+
|
4374
|
+
TapObservable.prototype.subscribeCore = function(o) {
|
4375
|
+
return this.source.subscribe(new InnerObserver(o, this));
|
4376
|
+
};
|
4377
|
+
|
4378
|
+
function InnerObserver(o, p) {
|
4379
|
+
this.o = o;
|
4380
|
+
this.t = !p._oN || isFunction(p._oN) ?
|
4381
|
+
observerCreate(p._oN || noop, p._oE || noop, p._oC || noop) :
|
4382
|
+
p._oN;
|
4383
|
+
this.isStopped = false;
|
4384
|
+
}
|
4385
|
+
InnerObserver.prototype.onNext = function(x) {
|
4386
|
+
if (this.isStopped) { return; }
|
4387
|
+
var res = tryCatch(this.t.onNext).call(this.t, x);
|
4388
|
+
if (res === errorObj) { this.o.onError(res.e); }
|
4389
|
+
this.o.onNext(x);
|
4390
|
+
};
|
4391
|
+
InnerObserver.prototype.onError = function(err) {
|
4392
|
+
if (!this.isStopped) {
|
4393
|
+
this.isStopped = true;
|
4394
|
+
var res = tryCatch(this.t.onError).call(this.t, err);
|
4395
|
+
if (res === errorObj) { return this.o.onError(res.e); }
|
4396
|
+
this.o.onError(err);
|
4397
|
+
}
|
4398
|
+
};
|
4399
|
+
InnerObserver.prototype.onCompleted = function() {
|
4400
|
+
if (!this.isStopped) {
|
4401
|
+
this.isStopped = true;
|
4402
|
+
var res = tryCatch(this.t.onCompleted).call(this.t);
|
4403
|
+
if (res === errorObj) { return this.o.onError(res.e); }
|
4404
|
+
this.o.onCompleted();
|
4405
|
+
}
|
4406
|
+
};
|
4407
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
4408
|
+
InnerObserver.prototype.fail = function (e) {
|
4409
|
+
if (!this.isStopped) {
|
4410
|
+
this.isStopped = true;
|
4411
|
+
this.o.onError(e);
|
4412
|
+
return true;
|
4413
|
+
}
|
4414
|
+
return false;
|
4415
|
+
};
|
4416
|
+
|
4417
|
+
return TapObservable;
|
4418
|
+
}(ObservableBase));
|
4419
|
+
|
4211
4420
|
/**
|
4212
|
-
|
4213
|
-
|
4214
|
-
|
4215
|
-
|
4216
|
-
|
4217
|
-
|
4218
|
-
|
4421
|
+
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
|
4422
|
+
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
4423
|
+
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an o.
|
4424
|
+
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
|
4425
|
+
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
|
4426
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
4427
|
+
*/
|
4219
4428
|
observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
|
4220
|
-
|
4221
|
-
return new AnonymousObservable(function (observer) {
|
4222
|
-
var tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ?
|
4223
|
-
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
|
4224
|
-
observerOrOnNext;
|
4225
|
-
|
4226
|
-
return source.subscribe(function (x) {
|
4227
|
-
try {
|
4228
|
-
tapObserver.onNext(x);
|
4229
|
-
} catch (e) {
|
4230
|
-
observer.onError(e);
|
4231
|
-
}
|
4232
|
-
observer.onNext(x);
|
4233
|
-
}, function (err) {
|
4234
|
-
try {
|
4235
|
-
tapObserver.onError(err);
|
4236
|
-
} catch (e) {
|
4237
|
-
observer.onError(e);
|
4238
|
-
}
|
4239
|
-
observer.onError(err);
|
4240
|
-
}, function () {
|
4241
|
-
try {
|
4242
|
-
tapObserver.onCompleted();
|
4243
|
-
} catch (e) {
|
4244
|
-
observer.onError(e);
|
4245
|
-
}
|
4246
|
-
observer.onCompleted();
|
4247
|
-
});
|
4248
|
-
}, this);
|
4429
|
+
return new TapObservable(this, observerOrOnNext, onError, onCompleted);
|
4249
4430
|
};
|
4250
4431
|
|
4251
4432
|
/**
|
4252
|
-
|
4253
|
-
|
4254
|
-
|
4255
|
-
|
4256
|
-
|
4257
|
-
|
4433
|
+
* Invokes an action for each element in the observable sequence.
|
4434
|
+
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
4435
|
+
* @param {Function} onNext Action to invoke for each element in the observable sequence.
|
4436
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
4437
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
4438
|
+
*/
|
4258
4439
|
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
|
4259
4440
|
return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext);
|
4260
4441
|
};
|
4261
4442
|
|
4262
4443
|
/**
|
4263
|
-
|
4264
|
-
|
4265
|
-
|
4266
|
-
|
4267
|
-
|
4268
|
-
|
4444
|
+
* Invokes an action upon exceptional termination of the observable sequence.
|
4445
|
+
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
4446
|
+
* @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.
|
4447
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
4448
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
4449
|
+
*/
|
4269
4450
|
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
|
4270
4451
|
return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError);
|
4271
4452
|
};
|
4272
4453
|
|
4273
4454
|
/**
|
4274
|
-
|
4275
|
-
|
4276
|
-
|
4277
|
-
|
4278
|
-
|
4279
|
-
|
4455
|
+
* Invokes an action upon graceful termination of the observable sequence.
|
4456
|
+
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
4457
|
+
* @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.
|
4458
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
4459
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
4460
|
+
*/
|
4280
4461
|
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
|
4281
4462
|
return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted);
|
4282
4463
|
};
|
@@ -4286,45 +4467,71 @@
|
|
4286
4467
|
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
|
4287
4468
|
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
|
4288
4469
|
*/
|
4289
|
-
observableProto['finally'] =
|
4470
|
+
observableProto['finally'] = function (action) {
|
4290
4471
|
var source = this;
|
4291
4472
|
return new AnonymousObservable(function (observer) {
|
4292
|
-
var subscription;
|
4293
|
-
|
4294
|
-
subscription = source.subscribe(observer);
|
4295
|
-
} catch (e) {
|
4473
|
+
var subscription = tryCatch(source.subscribe).call(source, observer);
|
4474
|
+
if (subscription === errorObj) {
|
4296
4475
|
action();
|
4297
|
-
|
4476
|
+
return thrower(subscription.e);
|
4298
4477
|
}
|
4299
4478
|
return disposableCreate(function () {
|
4300
|
-
|
4301
|
-
|
4302
|
-
|
4303
|
-
throw e;
|
4304
|
-
} finally {
|
4305
|
-
action();
|
4306
|
-
}
|
4479
|
+
var r = tryCatch(subscription.dispose).call(subscription);
|
4480
|
+
action();
|
4481
|
+
r === errorObj && thrower(r.e);
|
4307
4482
|
});
|
4308
4483
|
}, this);
|
4309
4484
|
};
|
4310
4485
|
|
4311
|
-
|
4312
|
-
|
4313
|
-
|
4314
|
-
|
4315
|
-
|
4316
|
-
|
4317
|
-
|
4486
|
+
var IgnoreElementsObservable = (function(__super__) {
|
4487
|
+
inherits(IgnoreElementsObservable, __super__);
|
4488
|
+
|
4489
|
+
function IgnoreElementsObservable(source) {
|
4490
|
+
this.source = source;
|
4491
|
+
__super__.call(this);
|
4492
|
+
}
|
4493
|
+
|
4494
|
+
IgnoreElementsObservable.prototype.subscribeCore = function (o) {
|
4495
|
+
return this.source.subscribe(new InnerObserver(o));
|
4496
|
+
};
|
4497
|
+
|
4498
|
+
function InnerObserver(o) {
|
4499
|
+
this.o = o;
|
4500
|
+
this.isStopped = false;
|
4501
|
+
}
|
4502
|
+
InnerObserver.prototype.onNext = noop;
|
4503
|
+
InnerObserver.prototype.onError = function (err) {
|
4504
|
+
if(!this.isStopped) {
|
4505
|
+
this.isStopped = true;
|
4506
|
+
this.o.onError(err);
|
4507
|
+
}
|
4508
|
+
};
|
4509
|
+
InnerObserver.prototype.onCompleted = function () {
|
4510
|
+
if(!this.isStopped) {
|
4511
|
+
this.isStopped = true;
|
4512
|
+
this.o.onCompleted();
|
4513
|
+
}
|
4514
|
+
};
|
4515
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
4516
|
+
InnerObserver.prototype.fail = function (e) {
|
4517
|
+
if (!this.isStopped) {
|
4518
|
+
this.isStopped = true;
|
4519
|
+
this.observer.onError(e);
|
4520
|
+
return true;
|
4521
|
+
}
|
4522
|
+
|
4523
|
+
return false;
|
4524
|
+
};
|
4525
|
+
|
4526
|
+
return IgnoreElementsObservable;
|
4527
|
+
}(ObservableBase));
|
4318
4528
|
|
4319
4529
|
/**
|
4320
4530
|
* Ignores all elements in an observable sequence leaving only the termination messages.
|
4321
4531
|
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
|
4322
4532
|
*/
|
4323
4533
|
observableProto.ignoreElements = function () {
|
4324
|
-
|
4325
|
-
return new AnonymousObservable(function (o) {
|
4326
|
-
return source.subscribe(noop, function (e) { o.onError(e); }, function () { o.onCompleted(); });
|
4327
|
-
}, source);
|
4534
|
+
return new IgnoreElementsObservable(this);
|
4328
4535
|
};
|
4329
4536
|
|
4330
4537
|
/**
|
@@ -4382,51 +4589,84 @@
|
|
4382
4589
|
observableProto.retryWhen = function (notifier) {
|
4383
4590
|
return enumerableRepeat(this).catchErrorWhen(notifier);
|
4384
4591
|
};
|
4592
|
+
var ScanObservable = (function(__super__) {
|
4593
|
+
inherits(ScanObservable, __super__);
|
4594
|
+
function ScanObservable(source, accumulator, hasSeed, seed) {
|
4595
|
+
this.source = source;
|
4596
|
+
this.accumulator = accumulator;
|
4597
|
+
this.hasSeed = hasSeed;
|
4598
|
+
this.seed = seed;
|
4599
|
+
__super__.call(this);
|
4600
|
+
}
|
4601
|
+
|
4602
|
+
ScanObservable.prototype.subscribeCore = function(o) {
|
4603
|
+
return this.source.subscribe(new InnerObserver(o,this));
|
4604
|
+
};
|
4605
|
+
|
4606
|
+
return ScanObservable;
|
4607
|
+
}(ObservableBase));
|
4608
|
+
|
4609
|
+
function InnerObserver(o, parent) {
|
4610
|
+
this.o = o;
|
4611
|
+
this.accumulator = parent.accumulator;
|
4612
|
+
this.hasSeed = parent.hasSeed;
|
4613
|
+
this.seed = parent.seed;
|
4614
|
+
this.hasAccumulation = false;
|
4615
|
+
this.accumulation = null;
|
4616
|
+
this.hasValue = false;
|
4617
|
+
this.isStopped = false;
|
4618
|
+
}
|
4619
|
+
InnerObserver.prototype = {
|
4620
|
+
onNext: function (x) {
|
4621
|
+
if (this.isStopped) { return; }
|
4622
|
+
!this.hasValue && (this.hasValue = true);
|
4623
|
+
if (this.hasAccumulation) {
|
4624
|
+
this.accumulation = tryCatch(this.accumulator)(this.accumulation, x);
|
4625
|
+
} else {
|
4626
|
+
this.accumulation = this.hasSeed ? tryCatch(this.accumulator)(this.seed, x) : x;
|
4627
|
+
this.hasAccumulation = true;
|
4628
|
+
}
|
4629
|
+
if (this.accumulation === errorObj) { return this.o.onError(this.accumulation.e); }
|
4630
|
+
this.o.onNext(this.accumulation);
|
4631
|
+
},
|
4632
|
+
onError: function (e) {
|
4633
|
+
if (!this.isStopped) {
|
4634
|
+
this.isStopped = true;
|
4635
|
+
this.o.onError(e);
|
4636
|
+
}
|
4637
|
+
},
|
4638
|
+
onCompleted: function () {
|
4639
|
+
if (!this.isStopped) {
|
4640
|
+
this.isStopped = true;
|
4641
|
+
!this.hasValue && this.hasSeed && this.o.onNext(this.seed);
|
4642
|
+
this.o.onCompleted();
|
4643
|
+
}
|
4644
|
+
},
|
4645
|
+
dispose: function() { this.isStopped = true; },
|
4646
|
+
fail: function (e) {
|
4647
|
+
if (!this.isStopped) {
|
4648
|
+
this.isStopped = true;
|
4649
|
+
this.o.onError(e);
|
4650
|
+
return true;
|
4651
|
+
}
|
4652
|
+
return false;
|
4653
|
+
}
|
4654
|
+
};
|
4655
|
+
|
4385
4656
|
/**
|
4386
|
-
|
4387
|
-
|
4388
|
-
|
4389
|
-
|
4390
|
-
|
4391
|
-
|
4392
|
-
* @param {Function} accumulator An accumulator function to be invoked on each element.
|
4393
|
-
* @returns {Observable} An observable sequence containing the accumulated values.
|
4394
|
-
*/
|
4657
|
+
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
|
4658
|
+
* For aggregation behavior with no intermediate results, see Observable.aggregate.
|
4659
|
+
* @param {Mixed} [seed] The initial accumulator value.
|
4660
|
+
* @param {Function} accumulator An accumulator function to be invoked on each element.
|
4661
|
+
* @returns {Observable} An observable sequence containing the accumulated values.
|
4662
|
+
*/
|
4395
4663
|
observableProto.scan = function () {
|
4396
|
-
var hasSeed = false, seed, accumulator
|
4664
|
+
var hasSeed = false, seed, accumulator = arguments[0];
|
4397
4665
|
if (arguments.length === 2) {
|
4398
4666
|
hasSeed = true;
|
4399
|
-
seed = arguments[
|
4400
|
-
accumulator = arguments[1];
|
4401
|
-
} else {
|
4402
|
-
accumulator = arguments[0];
|
4667
|
+
seed = arguments[1];
|
4403
4668
|
}
|
4404
|
-
return new
|
4405
|
-
var hasAccumulation, accumulation, hasValue;
|
4406
|
-
return source.subscribe (
|
4407
|
-
function (x) {
|
4408
|
-
!hasValue && (hasValue = true);
|
4409
|
-
try {
|
4410
|
-
if (hasAccumulation) {
|
4411
|
-
accumulation = accumulator(accumulation, x);
|
4412
|
-
} else {
|
4413
|
-
accumulation = hasSeed ? accumulator(seed, x) : x;
|
4414
|
-
hasAccumulation = true;
|
4415
|
-
}
|
4416
|
-
} catch (e) {
|
4417
|
-
o.onError(e);
|
4418
|
-
return;
|
4419
|
-
}
|
4420
|
-
|
4421
|
-
o.onNext(accumulation);
|
4422
|
-
},
|
4423
|
-
function (e) { o.onError(e); },
|
4424
|
-
function () {
|
4425
|
-
!hasValue && hasSeed && o.onNext(seed);
|
4426
|
-
o.onCompleted();
|
4427
|
-
}
|
4428
|
-
);
|
4429
|
-
}, source);
|
4669
|
+
return new ScanObservable(this, accumulator, hasSeed, seed);
|
4430
4670
|
};
|
4431
4671
|
|
4432
4672
|
/**
|
@@ -4568,52 +4808,9 @@
|
|
4568
4808
|
}, source);
|
4569
4809
|
};
|
4570
4810
|
|
4571
|
-
|
4572
|
-
|
4573
|
-
|
4574
|
-
var result = selectorFunc(x, i, source);
|
4575
|
-
isPromise(result) && (result = observableFromPromise(result));
|
4576
|
-
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
|
4577
|
-
return result;
|
4578
|
-
}).concatAll();
|
4579
|
-
}
|
4580
|
-
|
4581
|
-
/**
|
4582
|
-
* One of the Following:
|
4583
|
-
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
|
4584
|
-
*
|
4585
|
-
* @example
|
4586
|
-
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
|
4587
|
-
* Or:
|
4588
|
-
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
|
4589
|
-
*
|
4590
|
-
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
|
4591
|
-
* Or:
|
4592
|
-
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
|
4593
|
-
*
|
4594
|
-
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
|
4595
|
-
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
|
4596
|
-
* source sequence onto which could be either an observable or Promise.
|
4597
|
-
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
|
4598
|
-
* @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.
|
4599
|
-
*/
|
4600
|
-
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
|
4601
|
-
if (isFunction(selector) && isFunction(resultSelector)) {
|
4602
|
-
return this.concatMap(function (x, i) {
|
4603
|
-
var selectorResult = selector(x, i);
|
4604
|
-
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
|
4605
|
-
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
|
4606
|
-
|
4607
|
-
return selectorResult.map(function (y, i2) {
|
4608
|
-
return resultSelector(x, y, i, i2);
|
4609
|
-
});
|
4610
|
-
});
|
4611
|
-
}
|
4612
|
-
return isFunction(selector) ?
|
4613
|
-
concatMap(this, selector, thisArg) :
|
4614
|
-
concatMap(this, function () { return selector; });
|
4615
|
-
};
|
4616
|
-
|
4811
|
+
observableProto.flatMapConcat = observableProto.concatMap = function(selector, resultSelector, thisArg) {
|
4812
|
+
return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(1);
|
4813
|
+
};
|
4617
4814
|
/**
|
4618
4815
|
* Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence.
|
4619
4816
|
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
|
@@ -4756,51 +4953,52 @@
|
|
4756
4953
|
__super__.call(this);
|
4757
4954
|
}
|
4758
4955
|
|
4956
|
+
function innerMap(selector, self) {
|
4957
|
+
return function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }
|
4958
|
+
}
|
4959
|
+
|
4759
4960
|
MapObservable.prototype.internalMap = function (selector, thisArg) {
|
4760
|
-
|
4761
|
-
return new MapObservable(this.source, function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }, thisArg)
|
4961
|
+
return new MapObservable(this.source, innerMap(selector, this), thisArg);
|
4762
4962
|
};
|
4763
4963
|
|
4764
|
-
MapObservable.prototype.subscribeCore = function (
|
4765
|
-
return this.source.subscribe(new
|
4964
|
+
MapObservable.prototype.subscribeCore = function (o) {
|
4965
|
+
return this.source.subscribe(new InnerObserver(o, this.selector, this));
|
4766
4966
|
};
|
4767
4967
|
|
4768
|
-
|
4968
|
+
function InnerObserver(o, selector, source) {
|
4969
|
+
this.o = o;
|
4970
|
+
this.selector = selector;
|
4971
|
+
this.source = source;
|
4972
|
+
this.i = 0;
|
4973
|
+
this.isStopped = false;
|
4974
|
+
}
|
4769
4975
|
|
4770
|
-
|
4976
|
+
InnerObserver.prototype.onNext = function(x) {
|
4977
|
+
if (this.isStopped) { return; }
|
4978
|
+
var result = tryCatch(this.selector)(x, this.i++, this.source);
|
4979
|
+
if (result === errorObj) { return this.o.onError(result.e); }
|
4980
|
+
this.o.onNext(result);
|
4981
|
+
};
|
4982
|
+
InnerObserver.prototype.onError = function (e) {
|
4983
|
+
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
|
4984
|
+
};
|
4985
|
+
InnerObserver.prototype.onCompleted = function () {
|
4986
|
+
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
|
4987
|
+
};
|
4988
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
4989
|
+
InnerObserver.prototype.fail = function (e) {
|
4990
|
+
if (!this.isStopped) {
|
4991
|
+
this.isStopped = true;
|
4992
|
+
this.o.onError(e);
|
4993
|
+
return true;
|
4994
|
+
}
|
4771
4995
|
|
4772
|
-
|
4773
|
-
|
4774
|
-
this.selector = selector;
|
4775
|
-
this.source = source;
|
4776
|
-
this.i = 0;
|
4777
|
-
this.isStopped = false;
|
4778
|
-
}
|
4996
|
+
return false;
|
4997
|
+
};
|
4779
4998
|
|
4780
|
-
|
4781
|
-
if (this.isStopped) { return; }
|
4782
|
-
var result = tryCatch(this.selector).call(this, x, this.i++, this.source);
|
4783
|
-
if (result === errorObj) {
|
4784
|
-
return this.observer.onError(result.e);
|
4785
|
-
}
|
4786
|
-
this.observer.onNext(result);
|
4787
|
-
};
|
4788
|
-
MapObserver.prototype.onError = function (e) {
|
4789
|
-
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
|
4790
|
-
};
|
4791
|
-
MapObserver.prototype.onCompleted = function () {
|
4792
|
-
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
|
4793
|
-
};
|
4794
|
-
MapObserver.prototype.dispose = function() { this.isStopped = true; };
|
4795
|
-
MapObserver.prototype.fail = function (e) {
|
4796
|
-
if (!this.isStopped) {
|
4797
|
-
this.isStopped = true;
|
4798
|
-
this.observer.onError(e);
|
4799
|
-
return true;
|
4800
|
-
}
|
4999
|
+
return MapObservable;
|
4801
5000
|
|
4802
|
-
|
4803
|
-
};
|
5001
|
+
}(ObservableBase));
|
4804
5002
|
|
4805
5003
|
/**
|
4806
5004
|
* Projects each element of an observable sequence into a new form by incorporating the element's index.
|
@@ -4815,16 +5013,8 @@
|
|
4815
5013
|
new MapObservable(this, selectorFn, thisArg);
|
4816
5014
|
};
|
4817
5015
|
|
4818
|
-
|
4819
|
-
|
4820
|
-
* the Observable sequence.
|
4821
|
-
* @param {Arguments} arguments The nested properties to pluck.
|
4822
|
-
* @returns {Observable} Returns a new Observable sequence of property values.
|
4823
|
-
*/
|
4824
|
-
observableProto.pluck = function () {
|
4825
|
-
var args = arguments, len = arguments.length;
|
4826
|
-
if (len === 0) { throw new Error('List of properties cannot be empty.'); }
|
4827
|
-
return this.map(function (x) {
|
5016
|
+
function plucker(args, len) {
|
5017
|
+
return function mapper(x) {
|
4828
5018
|
var currentProp = x;
|
4829
5019
|
for (var i = 0; i < len; i++) {
|
4830
5020
|
var p = currentProp[args[i]];
|
@@ -4835,55 +5025,33 @@
|
|
4835
5025
|
}
|
4836
5026
|
}
|
4837
5027
|
return currentProp;
|
4838
|
-
}
|
4839
|
-
};
|
4840
|
-
|
4841
|
-
function flatMap(source, selector, thisArg) {
|
4842
|
-
var selectorFunc = bindCallback(selector, thisArg, 3);
|
4843
|
-
return source.map(function (x, i) {
|
4844
|
-
var result = selectorFunc(x, i, source);
|
4845
|
-
isPromise(result) && (result = observableFromPromise(result));
|
4846
|
-
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
|
4847
|
-
return result;
|
4848
|
-
}).mergeAll();
|
5028
|
+
}
|
4849
5029
|
}
|
4850
5030
|
|
4851
5031
|
/**
|
4852
|
-
*
|
4853
|
-
*
|
4854
|
-
*
|
4855
|
-
* @
|
4856
|
-
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
|
4857
|
-
* Or:
|
4858
|
-
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
|
4859
|
-
*
|
4860
|
-
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
|
4861
|
-
* Or:
|
4862
|
-
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
|
4863
|
-
*
|
4864
|
-
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
|
4865
|
-
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto which could be either an observable or Promise.
|
4866
|
-
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
|
4867
|
-
* @param {Any} [thisArg] Object to use as this when executing callback.
|
4868
|
-
* @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.
|
5032
|
+
* Retrieves the value of a specified nested property from all elements in
|
5033
|
+
* the Observable sequence.
|
5034
|
+
* @param {Arguments} arguments The nested properties to pluck.
|
5035
|
+
* @returns {Observable} Returns a new Observable sequence of property values.
|
4869
5036
|
*/
|
4870
|
-
observableProto.
|
4871
|
-
|
4872
|
-
|
4873
|
-
|
4874
|
-
|
4875
|
-
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
|
4876
|
-
|
4877
|
-
return selectorResult.map(function (y, i2) {
|
4878
|
-
return resultSelector(x, y, i, i2);
|
4879
|
-
});
|
4880
|
-
}, thisArg);
|
4881
|
-
}
|
4882
|
-
return isFunction(selector) ?
|
4883
|
-
flatMap(this, selector, thisArg) :
|
4884
|
-
flatMap(this, function () { return selector; });
|
5037
|
+
observableProto.pluck = function () {
|
5038
|
+
var len = arguments.length, args = new Array(len);
|
5039
|
+
if (len === 0) { throw new Error('List of properties cannot be empty.'); }
|
5040
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
5041
|
+
return this.map(plucker(args, len));
|
4885
5042
|
};
|
4886
5043
|
|
5044
|
+
observableProto.flatMap = observableProto.selectMany = function(selector, resultSelector, thisArg) {
|
5045
|
+
return new FlatMapObservable(this, selector, resultSelector, thisArg).mergeAll();
|
5046
|
+
};
|
5047
|
+
|
5048
|
+
|
5049
|
+
//
|
5050
|
+
//Rx.Observable.prototype.flatMapWithMaxConcurrent = function(limit, selector, resultSelector, thisArg) {
|
5051
|
+
// return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(limit);
|
5052
|
+
//};
|
5053
|
+
//
|
5054
|
+
|
4887
5055
|
/**
|
4888
5056
|
* Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
|
4889
5057
|
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
|
@@ -4936,18 +5104,54 @@
|
|
4936
5104
|
}, source).mergeAll();
|
4937
5105
|
};
|
4938
5106
|
|
4939
|
-
|
4940
|
-
|
4941
|
-
|
4942
|
-
|
4943
|
-
|
4944
|
-
|
4945
|
-
|
4946
|
-
|
4947
|
-
|
4948
|
-
|
4949
|
-
|
4950
|
-
|
5107
|
+
Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisArg) {
|
5108
|
+
return new FlatMapObservable(this, selector, resultSelector, thisArg).switchLatest();
|
5109
|
+
};
|
5110
|
+
var SkipObservable = (function(__super__) {
|
5111
|
+
inherits(SkipObservable, __super__);
|
5112
|
+
function SkipObservable(source, count) {
|
5113
|
+
this.source = source;
|
5114
|
+
this.skipCount = count;
|
5115
|
+
__super__.call(this);
|
5116
|
+
}
|
5117
|
+
|
5118
|
+
SkipObservable.prototype.subscribeCore = function (o) {
|
5119
|
+
return this.source.subscribe(new InnerObserver(o, this.skipCount));
|
5120
|
+
};
|
5121
|
+
|
5122
|
+
function InnerObserver(o, c) {
|
5123
|
+
this.c = c;
|
5124
|
+
this.r = c;
|
5125
|
+
this.o = o;
|
5126
|
+
this.isStopped = false;
|
5127
|
+
}
|
5128
|
+
InnerObserver.prototype.onNext = function (x) {
|
5129
|
+
if (this.isStopped) { return; }
|
5130
|
+
if (this.r <= 0) {
|
5131
|
+
this.o.onNext(x);
|
5132
|
+
} else {
|
5133
|
+
this.r--;
|
5134
|
+
}
|
5135
|
+
};
|
5136
|
+
InnerObserver.prototype.onError = function(e) {
|
5137
|
+
if (!this.isStopped) { this.isStopped = true; this.o.onError(e); }
|
5138
|
+
};
|
5139
|
+
InnerObserver.prototype.onCompleted = function() {
|
5140
|
+
if (!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
|
5141
|
+
};
|
5142
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
5143
|
+
InnerObserver.prototype.fail = function(e) {
|
5144
|
+
if (!this.isStopped) {
|
5145
|
+
this.isStopped = true;
|
5146
|
+
this.o.onError(e);
|
5147
|
+
return true;
|
5148
|
+
}
|
5149
|
+
return false;
|
5150
|
+
};
|
5151
|
+
|
5152
|
+
return SkipObservable;
|
5153
|
+
}(ObservableBase));
|
5154
|
+
|
4951
5155
|
/**
|
4952
5156
|
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
|
4953
5157
|
* @param {Number} count The number of elements to skip before returning the remaining elements.
|
@@ -4955,19 +5159,8 @@
|
|
4955
5159
|
*/
|
4956
5160
|
observableProto.skip = function (count) {
|
4957
5161
|
if (count < 0) { throw new ArgumentOutOfRangeError(); }
|
4958
|
-
|
4959
|
-
return new AnonymousObservable(function (o) {
|
4960
|
-
var remaining = count;
|
4961
|
-
return source.subscribe(function (x) {
|
4962
|
-
if (remaining <= 0) {
|
4963
|
-
o.onNext(x);
|
4964
|
-
} else {
|
4965
|
-
remaining--;
|
4966
|
-
}
|
4967
|
-
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
|
4968
|
-
}, source);
|
5162
|
+
return new SkipObservable(this, count);
|
4969
5163
|
};
|
4970
|
-
|
4971
5164
|
/**
|
4972
5165
|
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
|
4973
5166
|
* The element's index is used in the logic of the predicate function.
|
@@ -5015,7 +5208,7 @@
|
|
5015
5208
|
return source.subscribe(function (x) {
|
5016
5209
|
if (remaining-- > 0) {
|
5017
5210
|
o.onNext(x);
|
5018
|
-
remaining
|
5211
|
+
remaining <= 0 && o.onCompleted();
|
5019
5212
|
}
|
5020
5213
|
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
|
5021
5214
|
}, source);
|
@@ -5060,51 +5253,54 @@
|
|
5060
5253
|
__super__.call(this);
|
5061
5254
|
}
|
5062
5255
|
|
5063
|
-
FilterObservable.prototype.subscribeCore = function (
|
5064
|
-
return this.source.subscribe(new
|
5256
|
+
FilterObservable.prototype.subscribeCore = function (o) {
|
5257
|
+
return this.source.subscribe(new InnerObserver(o, this.predicate, this));
|
5065
5258
|
};
|
5259
|
+
|
5260
|
+
function innerPredicate(predicate, self) {
|
5261
|
+
return function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }
|
5262
|
+
}
|
5066
5263
|
|
5067
5264
|
FilterObservable.prototype.internalFilter = function(predicate, thisArg) {
|
5068
|
-
|
5069
|
-
|
5265
|
+
return new FilterObservable(this.source, innerPredicate(predicate, this), thisArg);
|
5266
|
+
};
|
5267
|
+
|
5268
|
+
function InnerObserver(o, predicate, source) {
|
5269
|
+
this.o = o;
|
5270
|
+
this.predicate = predicate;
|
5271
|
+
this.source = source;
|
5272
|
+
this.i = 0;
|
5273
|
+
this.isStopped = false;
|
5274
|
+
}
|
5275
|
+
|
5276
|
+
InnerObserver.prototype.onNext = function(x) {
|
5277
|
+
if (this.isStopped) { return; }
|
5278
|
+
var shouldYield = tryCatch(this.predicate)(x, this.i++, this.source);
|
5279
|
+
if (shouldYield === errorObj) {
|
5280
|
+
return this.o.onError(shouldYield.e);
|
5281
|
+
}
|
5282
|
+
shouldYield && this.o.onNext(x);
|
5283
|
+
};
|
5284
|
+
InnerObserver.prototype.onError = function (e) {
|
5285
|
+
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
|
5286
|
+
};
|
5287
|
+
InnerObserver.prototype.onCompleted = function () {
|
5288
|
+
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
|
5289
|
+
};
|
5290
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
5291
|
+
InnerObserver.prototype.fail = function (e) {
|
5292
|
+
if (!this.isStopped) {
|
5293
|
+
this.isStopped = true;
|
5294
|
+
this.o.onError(e);
|
5295
|
+
return true;
|
5296
|
+
}
|
5297
|
+
return false;
|
5070
5298
|
};
|
5071
5299
|
|
5072
5300
|
return FilterObservable;
|
5073
5301
|
|
5074
5302
|
}(ObservableBase));
|
5075
5303
|
|
5076
|
-
function FilterObserver(observer, predicate, source) {
|
5077
|
-
this.observer = observer;
|
5078
|
-
this.predicate = predicate;
|
5079
|
-
this.source = source;
|
5080
|
-
this.i = 0;
|
5081
|
-
this.isStopped = false;
|
5082
|
-
}
|
5083
|
-
|
5084
|
-
FilterObserver.prototype.onNext = function(x) {
|
5085
|
-
if (this.isStopped) { return; }
|
5086
|
-
var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source);
|
5087
|
-
if (shouldYield === errorObj) {
|
5088
|
-
return this.observer.onError(shouldYield.e);
|
5089
|
-
}
|
5090
|
-
shouldYield && this.observer.onNext(x);
|
5091
|
-
};
|
5092
|
-
FilterObserver.prototype.onError = function (e) {
|
5093
|
-
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
|
5094
|
-
};
|
5095
|
-
FilterObserver.prototype.onCompleted = function () {
|
5096
|
-
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
|
5097
|
-
};
|
5098
|
-
FilterObserver.prototype.dispose = function() { this.isStopped = true; };
|
5099
|
-
FilterObserver.prototype.fail = function (e) {
|
5100
|
-
if (!this.isStopped) {
|
5101
|
-
this.isStopped = true;
|
5102
|
-
this.observer.onError(e);
|
5103
|
-
return true;
|
5104
|
-
}
|
5105
|
-
return false;
|
5106
|
-
};
|
5107
|
-
|
5108
5304
|
/**
|
5109
5305
|
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
|
5110
5306
|
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
|
@@ -5142,11 +5338,8 @@
|
|
5142
5338
|
var xform = transducer(transformForObserver(o));
|
5143
5339
|
return source.subscribe(
|
5144
5340
|
function(v) {
|
5145
|
-
|
5146
|
-
|
5147
|
-
} catch (e) {
|
5148
|
-
o.onError(e);
|
5149
|
-
}
|
5341
|
+
var res = tryCatch(xform['@@transducer/step']).call(xform, o, v);
|
5342
|
+
if (res === errorObj) { o.onError(res.e); }
|
5150
5343
|
},
|
5151
5344
|
function (e) { o.onError(e); },
|
5152
5345
|
function() { xform['@@transducer/result'](o); }
|
@@ -5164,8 +5357,8 @@
|
|
5164
5357
|
}
|
5165
5358
|
|
5166
5359
|
function setDisposable(s, state) {
|
5167
|
-
var ado = state[0],
|
5168
|
-
var sub = tryCatch(
|
5360
|
+
var ado = state[0], self = state[1];
|
5361
|
+
var sub = tryCatch(self.__subscribe).call(self, ado);
|
5169
5362
|
|
5170
5363
|
if (sub === errorObj) {
|
5171
5364
|
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
|
@@ -5173,21 +5366,21 @@
|
|
5173
5366
|
ado.setDisposable(fixSubscriber(sub));
|
5174
5367
|
}
|
5175
5368
|
|
5176
|
-
function
|
5177
|
-
|
5178
|
-
|
5179
|
-
function s(observer) {
|
5180
|
-
var ado = new AutoDetachObserver(observer), state = [ado, subscribe];
|
5369
|
+
function innerSubscribe(observer) {
|
5370
|
+
var ado = new AutoDetachObserver(observer), state = [ado, this];
|
5181
5371
|
|
5182
|
-
|
5183
|
-
|
5184
|
-
|
5185
|
-
|
5186
|
-
}
|
5187
|
-
return ado;
|
5372
|
+
if (currentThreadScheduler.scheduleRequired()) {
|
5373
|
+
currentThreadScheduler.scheduleWithState(state, setDisposable);
|
5374
|
+
} else {
|
5375
|
+
setDisposable(null, state);
|
5188
5376
|
}
|
5377
|
+
return ado;
|
5378
|
+
}
|
5189
5379
|
|
5190
|
-
|
5380
|
+
function AnonymousObservable(subscribe, parent) {
|
5381
|
+
this.source = parent;
|
5382
|
+
this.__subscribe = subscribe;
|
5383
|
+
__super__.call(this, innerSubscribe);
|
5191
5384
|
}
|
5192
5385
|
|
5193
5386
|
return AnonymousObservable;
|