rxjs-rails 2.4.1 → 2.5.2
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 +15 -19
- 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 +1014 -566
- 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 +1009 -563
- 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 +17 -15
- 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 +17 -15
- 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 +53 -43
- 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 +31 -12
- 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 +3 -2
- 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 +821 -444
- data/vendor/assets/javascripts/rx.compat.map +1 -1
- data/vendor/assets/javascripts/rx.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.experimental.js +2 -9
- 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 +14 -22
- 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 +817 -442
- data/vendor/assets/javascripts/rx.lite.compat.js +897 -443
- data/vendor/assets/javascripts/rx.lite.compat.map +1 -1
- data/vendor/assets/javascripts/rx.lite.compat.min.js +3 -2
- data/vendor/assets/javascripts/rx.lite.extras.compat.js +621 -0
- data/vendor/assets/javascripts/rx.lite.extras.compat.map +1 -0
- data/vendor/assets/javascripts/rx.lite.extras.compat.min.js +3 -0
- data/vendor/assets/javascripts/rx.lite.extras.js +53 -76
- 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 +898 -444
- data/vendor/assets/javascripts/rx.lite.map +1 -1
- data/vendor/assets/javascripts/rx.lite.min.js +3 -2
- data/vendor/assets/javascripts/rx.map +1 -1
- data/vendor/assets/javascripts/rx.min.js +2 -2
- data/vendor/assets/javascripts/rx.testing.js +10 -11
- 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 +80 -40
- 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 +6 -13
- data/vendor/assets/javascripts/rx.virtualtime.map +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -1
- metadata +6 -3
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rx.lite.extras.compat.min.js","sources":["rx.lite.extras.compat.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","ScheduledDisposable","scheduler","disposable","isDisposed","scheduleItem","s","self","dispose","arrayIndexOfComparer","array","item","comparer","i","len","length","HashSet","set","Observable","observableProto","prototype","observableNever","never","observableThrow","throwException","AnonymousObservable","AnonymousObserver","notificationCreateOnNext","Notification","createOnNext","notificationCreateOnError","createOnError","notificationCreateOnCompleted","createOnCompleted","Observer","Subject","internals","helpers","ScheduledObserver","SerialDisposable","SingleAssignmentDisposable","CompositeDisposable","RefCountDisposable","disposableEmpty","Disposable","empty","immediateScheduler","Scheduler","immediate","addRef","defaultKeySerializer","isPromise","identity","inherits","bindCallback","isScheduler","noop","observableFromPromise","fromPromise","ArgumentOutOfRangeError","scheduleWithState","CheckedObserver","__super__","observer","_observer","_state","CheckedObserverPrototype","onNext","value","checkAccess","res","tryCatch","errorObj","thrower","e","onError","err","onCompleted","Error","ObserveOnObserver","cancel","_cancel","next","ensureActive","error","completed","checked","notifyOn","fromNotifier","handler","thisArg","handlerFunc","x","toNotifier","n","accept","asObserver","source","observeOn","subscribe","subscribeOn","m","d","setDisposable","schedule","generate","initialState","condition","iterate","resultSelector","currentThreadScheduler","o","first","scheduleRecursiveWithState","state","hasResult","result","using","resourceFactory","observableFactory","resource","exception","amb","rightSource","leftSource","choiceL","choice","leftChoice","rightSubscription","choiceR","rightChoice","leftSubscription","left","right","func","previous","current","acc","items","Array","isArray","arguments","push","onErrorResumeNext","second","sources","pos","subscription","cancelable","scheduleRecursive","bind","bufferWithCount","count","skip","windowWithCount","selectMany","toArray","where","Infinity","Math","abs","createWindow","q","refCountDisposable","c","shift","takeLastBuffer","defaultIfEmpty","defaultValue","found","retValue","distinct","keySelector","defaultComparer","hashSet","key"],"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,S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QD,IAChC,YACG+F,GAAS1G,EAASI,OAAOqG,GAC1BzG,EAASc,iBAEVoB,IAePjF,EAAQI,UAAU0H,KAAO,SAAS1E,GAChC,GAAIsG,GAAoE,KAAzDjK,EAAqBtB,KAAK8B,IAAKmD,EAAOjF,KAAKyB,SAE1D,OADA8J,IAAYvL,KAAK8B,IAAI6H,KAAK1E,GACnBsG,GAeTvJ,EAAgBwJ,SAAW,SAAUC,EAAahK,GAChD,GAAIqF,GAAS9G,IAEb,OADAyB,KAAaA,EAAWiK,iBACjB,GAAIpJ,GAAoB,SAAUsF,GACvC,GAAI+D,GAAU,GAAI9J,GAAQJ,EAC1B,OAAOqF,GAAOE,UAAU,SAAUP,GAChC,GAAImF,GAAMnF,CAEV,IAAIgF,EACF,IACEG,EAAMH,EAAYhF,GAClB,MAAOlB,GAEP,WADAqC,GAAEpC,QAAQD,GAIdoG,EAAQhC,KAAKiC,IAAQhE,EAAE5C,OAAOyB,IAEhC,SAAUlB,GAAKqC,EAAEpC,QAAQD,IAAO,WAAcqC,EAAElC,iBAC/C1F,OAGIU"}
|
@@ -0,0 +1,3 @@
|
|
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={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx-lite-compat"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("rx-lite-compat")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function f(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function g(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function h(a){this.comparer=a,this.set=[]}var i=c.Observable,j=i.prototype,k=i.never,l=i.throwException,m=c.AnonymousObservable,n=c.AnonymousObserver,o=c.Notification.createOnNext,p=c.Notification.createOnError,q=c.Notification.createOnCompleted,r=c.Observer,s=c.Subject,t=c.internals,u=c.helpers,v=t.ScheduledObserver,w=c.SerialDisposable,x=c.SingleAssignmentDisposable,y=c.CompositeDisposable,z=c.RefCountDisposable,A=c.Disposable.empty,B=c.Scheduler.immediate,C=(u.defaultKeySerializer,c.internals.addRef),D=(u.identity,u.isPromise),E=t.inherits,F=t.bindCallback,G=(u.noop,c.Scheduler.isScheduler),H=i.fromPromise,I=c.ArgumentOutOfRangeError;e.prototype.dispose=function(){this.scheduler.scheduleWithState(this,f)};var J=function(a){function b(b){a.call(this),this._observer=b,this._state=0}E(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=tryCatch(this._observer.onNext).call(this._observer,a);this._state=0,b===errorObj&&thrower(b.e)},c.onError=function(a){this.checkAccess();var b=tryCatch(this._observer.onError).call(this._observer,a);this._state=2,b===errorObj&&thrower(b.e)},c.onCompleted=function(){this.checkAccess();var a=tryCatch(this._observer.onCompleted).call(this._observer);this._state=2,a===errorObj&&thrower(a.e)},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(r),K=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return E(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(v);r.prototype.checked=function(){return new J(this)},r.notifyOn=function(a){return new K(a,this)},r.fromNotifier=function(a,b){var c=F(a,b,1);return new n(function(a){return c(o(a))},function(a){return c(p(a))},function(){return c(q())})},r.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},r.prototype.asObserver=function(){var a=this;return new n(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})},j.observeOn=function(a){var b=this;return new m(function(c){return b.subscribe(new K(a,c))},b)},j.subscribeOn=function(a){var b=this;return new m(function(c){var d=new x,f=new w;return f.setDisposable(d),d.setDisposable(a.schedule(function(){f.setDisposable(new e(a,b.subscribe(c)))})),f},b)},i.generate=function(a,b,c,d,e){return G(e)||(e=currentThreadScheduler),new m(function(f){var g=!0;return e.scheduleRecursiveWithState(a,function(a,e){var h,i;try{g?g=!1:a=c(a),h=b(a),h&&(i=d(a))}catch(j){return f.onError(j)}h?(f.onNext(i),e(a)):f.onCompleted()})})},i.using=function(a,b){return new m(function(c){var d,e,f=A;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new y(l(g).subscribe(c),f)}return new y(e.subscribe(c),f)})},j.amb=function(a){var b=this;return new m(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new x,j=new x;return D(a)&&(a=H(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new y(i,j)})},i.amb=function(){function a(a,b){return a.amb(b)}var b=k(),c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(var d=0,e=arguments.length;e>d;d++)c.push(arguments[d]);for(var d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},j.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return L([this,a])};var L=i.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new m(function(b){var c=0,d=new w,e=B.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],D(f)&&(f=H(f)),g=new x,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new y(d,e)})};return j.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},j.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new I;if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new I;return new m(function(d){function e(){var a=new s;i.push(a),d.onNext(C(a,g))}var f=new x,g=new z(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},j.takeLastBuffer=function(a){var b=this;return new m(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},j.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new m(function(c){var d=!1;return b.subscribe(function(a){d=!0,c.onNext(a)},function(a){c.onError(a)},function(){!d&&c.onNext(a),c.onCompleted()})},b)},h.prototype.push=function(a){var b=-1===g(this.set,a,this.comparer);return b&&this.set.push(a),b},j.distinct=function(a,b){var c=this;return b||(b=defaultComparer),new m(function(d){var e=new h(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},function(a){d.onError(a)},function(){d.onCompleted()})},this)},c});
|
3
|
+
//# sourceMappingURL=rx.lite.extras.compat.map
|
@@ -22,11 +22,11 @@
|
|
22
22
|
|
23
23
|
// Because of build optimizers
|
24
24
|
if (typeof define === 'function' && define.amd) {
|
25
|
-
define(['rx'], function (Rx, exports) {
|
25
|
+
define(['rx-lite'], function (Rx, exports) {
|
26
26
|
return factory(root, exports, Rx);
|
27
27
|
});
|
28
28
|
} else if (typeof module === 'object' && module && module.exports === freeExports) {
|
29
|
-
module.exports = factory(root, module.exports, require('
|
29
|
+
module.exports = factory(root, module.exports, require('rx-lite'));
|
30
30
|
} else {
|
31
31
|
root.Rx = factory(root, {}, root.Rx);
|
32
32
|
}
|
@@ -60,17 +60,9 @@
|
|
60
60
|
inherits = internals.inherits,
|
61
61
|
bindCallback = internals.bindCallback,
|
62
62
|
noop = helpers.noop,
|
63
|
-
isScheduler =
|
63
|
+
isScheduler = Rx.Scheduler.isScheduler,
|
64
64
|
observableFromPromise = Observable.fromPromise,
|
65
|
-
|
66
|
-
|
67
|
-
function argsOrArray(args, idx) {
|
68
|
-
return args.length === 1 && Array.isArray(args[idx]) ?
|
69
|
-
args[idx] :
|
70
|
-
slice.call(args);
|
71
|
-
}
|
72
|
-
|
73
|
-
var argumentOutOfRange = 'Argument out of range';
|
65
|
+
ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError;
|
74
66
|
|
75
67
|
function ScheduledDisposable(scheduler, disposable) {
|
76
68
|
this.scheduler = scheduler;
|
@@ -89,58 +81,46 @@
|
|
89
81
|
this.scheduler.scheduleWithState(this, scheduleItem);
|
90
82
|
};
|
91
83
|
|
92
|
-
|
93
|
-
|
84
|
+
var CheckedObserver = (function (__super__) {
|
85
|
+
inherits(CheckedObserver, __super__);
|
94
86
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
87
|
+
function CheckedObserver(observer) {
|
88
|
+
__super__.call(this);
|
89
|
+
this._observer = observer;
|
90
|
+
this._state = 0; // 0 - idle, 1 - busy, 2 - done
|
91
|
+
}
|
92
|
+
|
93
|
+
var CheckedObserverPrototype = CheckedObserver.prototype;
|
94
|
+
|
95
|
+
CheckedObserverPrototype.onNext = function (value) {
|
96
|
+
this.checkAccess();
|
97
|
+
var res = tryCatch(this._observer.onNext).call(this._observer, value);
|
98
|
+
this._state = 0;
|
99
|
+
res === errorObj && thrower(res.e);
|
100
|
+
};
|
101
|
+
|
102
|
+
CheckedObserverPrototype.onError = function (err) {
|
103
|
+
this.checkAccess();
|
104
|
+
var res = tryCatch(this._observer.onError).call(this._observer, err);
|
105
|
+
this._state = 2;
|
106
|
+
res === errorObj && thrower(res.e);
|
107
|
+
};
|
108
|
+
|
109
|
+
CheckedObserverPrototype.onCompleted = function () {
|
110
|
+
this.checkAccess();
|
111
|
+
var res = tryCatch(this._observer.onCompleted).call(this._observer);
|
112
|
+
this._state = 2;
|
113
|
+
res === errorObj && thrower(res.e);
|
114
|
+
};
|
115
|
+
|
116
|
+
CheckedObserverPrototype.checkAccess = function () {
|
117
|
+
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
|
118
|
+
if (this._state === 2) { throw new Error('Observer completed'); }
|
119
|
+
if (this._state === 0) { this._state = 1; }
|
120
|
+
};
|
100
121
|
|
101
|
-
|
102
|
-
|
103
|
-
CheckedObserverPrototype.onNext = function (value) {
|
104
|
-
this.checkAccess();
|
105
|
-
try {
|
106
|
-
this._observer.onNext(value);
|
107
|
-
} catch (e) {
|
108
|
-
throw e;
|
109
|
-
} finally {
|
110
|
-
this._state = 0;
|
111
|
-
}
|
112
|
-
};
|
113
|
-
|
114
|
-
CheckedObserverPrototype.onError = function (err) {
|
115
|
-
this.checkAccess();
|
116
|
-
try {
|
117
|
-
this._observer.onError(err);
|
118
|
-
} catch (e) {
|
119
|
-
throw e;
|
120
|
-
} finally {
|
121
|
-
this._state = 2;
|
122
|
-
}
|
123
|
-
};
|
124
|
-
|
125
|
-
CheckedObserverPrototype.onCompleted = function () {
|
126
|
-
this.checkAccess();
|
127
|
-
try {
|
128
|
-
this._observer.onCompleted();
|
129
|
-
} catch (e) {
|
130
|
-
throw e;
|
131
|
-
} finally {
|
132
|
-
this._state = 2;
|
133
|
-
}
|
134
|
-
};
|
135
|
-
|
136
|
-
CheckedObserverPrototype.checkAccess = function () {
|
137
|
-
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
|
138
|
-
if (this._state === 2) { throw new Error('Observer completed'); }
|
139
|
-
if (this._state === 0) { this._state = 1; }
|
140
|
-
};
|
141
|
-
|
142
|
-
return CheckedObserver;
|
143
|
-
}(Observer));
|
122
|
+
return CheckedObserver;
|
123
|
+
}(Observer));
|
144
124
|
|
145
125
|
var ObserveOnObserver = (function (__super__) {
|
146
126
|
inherits(ObserveOnObserver, __super__);
|
@@ -282,9 +262,9 @@
|
|
282
262
|
*/
|
283
263
|
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
|
284
264
|
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
|
285
|
-
return new AnonymousObservable(function (
|
286
|
-
var first = true
|
287
|
-
return scheduler.
|
265
|
+
return new AnonymousObservable(function (o) {
|
266
|
+
var first = true;
|
267
|
+
return scheduler.scheduleRecursiveWithState(initialState, function (state, self) {
|
288
268
|
var hasResult, result;
|
289
269
|
try {
|
290
270
|
if (first) {
|
@@ -293,18 +273,15 @@
|
|
293
273
|
state = iterate(state);
|
294
274
|
}
|
295
275
|
hasResult = condition(state);
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
} catch (exception) {
|
300
|
-
observer.onError(exception);
|
301
|
-
return;
|
276
|
+
hasResult && (result = resultSelector(state));
|
277
|
+
} catch (e) {
|
278
|
+
return o.onError(e);
|
302
279
|
}
|
303
280
|
if (hasResult) {
|
304
|
-
|
305
|
-
self();
|
281
|
+
o.onNext(result);
|
282
|
+
self(state);
|
306
283
|
} else {
|
307
|
-
|
284
|
+
o.onCompleted();
|
308
285
|
}
|
309
286
|
});
|
310
287
|
});
|
@@ -498,12 +475,12 @@
|
|
498
475
|
var source = this;
|
499
476
|
+count || (count = 0);
|
500
477
|
Math.abs(count) === Infinity && (count = 0);
|
501
|
-
if (count <= 0) { throw new
|
478
|
+
if (count <= 0) { throw new ArgumentOutOfRangeError(); }
|
502
479
|
skip == null && (skip = count);
|
503
480
|
+skip || (skip = 0);
|
504
481
|
Math.abs(skip) === Infinity && (skip = 0);
|
505
482
|
|
506
|
-
if (skip <= 0) { throw new
|
483
|
+
if (skip <= 0) { throw new ArgumentOutOfRangeError(); }
|
507
484
|
return new AnonymousObservable(function (observer) {
|
508
485
|
var m = new SingleAssignmentDisposable(),
|
509
486
|
refCountDisposable = new RefCountDisposable(m),
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rx.lite.extras.min.js","sources":["rx.lite.extras.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","ScheduledDisposable","scheduler","disposable","isDisposed","scheduleItem","s","self","dispose","arrayIndexOfComparer","array","item","comparer","i","len","length","HashSet","set","Observable","observableProto","prototype","observableNever","never","observableThrow","throwException","AnonymousObservable","AnonymousObserver","notificationCreateOnNext","Notification","createOnNext","notificationCreateOnError","createOnError","notificationCreateOnCompleted","createOnCompleted","Observer","Subject","internals","helpers","ScheduledObserver","SerialDisposable","SingleAssignmentDisposable","CompositeDisposable","RefCountDisposable","disposableEmpty","Disposable","empty","immediateScheduler","Scheduler","immediate","addRef","defaultKeySerializer","isPromise","identity","inherits","bindCallback","isScheduler","noop","observableFromPromise","fromPromise","argumentOutOfRange","Array","slice","scheduleWithState","CheckedObserver","_super","observer","_observer","_state","CheckedObserverPrototype","onNext","value","checkAccess","e","onError","err","onCompleted","Error","ObserveOnObserver","__super__","cancel","_cancel","next","ensureActive","error","completed","checked","notifyOn","fromNotifier","handler","thisArg","handlerFunc","x","toNotifier","n","accept","asObserver","source","observeOn","subscribe","subscribeOn","m","d","setDisposable","schedule","generate","initialState","condition","iterate","resultSelector","currentThreadScheduler","first","state","scheduleRecursive","hasResult","result","exception","using","resourceFactory","observableFactory","resource","amb","rightSource","leftSource","choiceL","choice","leftChoice","rightSubscription","choiceR","rightChoice","leftSubscription","left","right","func","previous","current","acc","items","isArray","arguments","push","onErrorResumeNext","second","sources","pos","subscription","cancelable","bind","bufferWithCount","count","skip","windowWithCount","selectMany","toArray","where","Infinity","Math","abs","createWindow","q","refCountDisposable","c","shift","takeLastBuffer","o","defaultIfEmpty","defaultValue","found","retValue","distinct","keySelector","defaultComparer","hashSet","key"],"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,GA0CpC,QAASiB,GAAoBC,EAAWC,GACtChB,KAAKe,UAAYA,EACjBf,KAAKgB,WAAaA,EAClBhB,KAAKiB,YAAa,EAGpB,QAASC,GAAaC,EAAGC,GAClBA,EAAKH,aACRG,EAAKH,YAAa,EAClBG,EAAKJ,WAAWK,WA4fpB,QAASC,GAAqBC,EAAOC,EAAMC,GACzC,IAAK,GAAIC,GAAI,EAAGC,EAAMJ,EAAMK,OAAYD,EAAJD,EAASA,IAC3C,GAAID,EAASF,EAAMG,GAAIF,GAAS,MAAOE,EAE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,GACPmE,EAAE/I,OAASqI,GAASU,EAAEG,SACrB,SAAUzF,GAAK2F,EAAE1F,QAAQD,IAAO,WACjC2F,EAAE9F,OAAOyF,GACTK,EAAExF,iBAEHqB,IAaH7E,EAAgBiJ,eAAiB,SAAUC,GACzC,GAAIrE,GAAS7G,IAEb,OADAkL,KAAiBrL,IAAcqL,EAAe,MACvC,GAAI5I,GAAoB,SAAUwC,GACvC,GAAIqG,IAAQ,CACZ,OAAOtE,GAAOE,UAAU,SAAUP,GAChC2E,GAAQ,EACRrG,EAASI,OAAOsB,IAElB,SAAUnB,GAAKP,EAASQ,QAAQD,IAChC,YACG8F,GAASrG,EAASI,OAAOgG,GAC1BpG,EAASU,iBAEVqB,IAePhF,EAAQI,UAAUuH,KAAO,SAASrE,GAChC,GAAIiG,GAAoE,KAAzD9J,EAAqBtB,KAAK8B,IAAKqD,EAAOnF,KAAKyB,SAE1D,OADA2J,IAAYpL,KAAK8B,IAAI0H,KAAKrE,GACnBiG,GAeTpJ,EAAgBqJ,SAAW,SAAUC,EAAa7J,GAChD,GAAIoF,GAAS7G,IAEb,OADAyB,KAAaA,EAAW8J,iBACjB,GAAIjJ,GAAoB,SAAU0I,GACvC,GAAIQ,GAAU,GAAI3J,GAAQJ,EAC1B,OAAOoF,GAAOE,UAAU,SAAUP,GAChC,GAAIiF,GAAMjF,CAEV,IAAI8E,EACF,IACEG,EAAMH,EAAY9E,GAClB,MAAOnB,GAEP,WADA2F,GAAE1F,QAAQD,GAIdmG,EAAQhC,KAAKiC,IAAQT,EAAE9F,OAAOsB,IAEhC,SAAUnB,GAAK2F,EAAE1F,QAAQD,IAAO,WAAc2F,EAAExF,iBAC/CxF,OAGIU"}
|
1
|
+
{"version":3,"file":"rx.lite.extras.min.js","sources":["rx.lite.extras.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","ScheduledDisposable","scheduler","disposable","isDisposed","scheduleItem","s","self","dispose","arrayIndexOfComparer","array","item","comparer","i","len","length","HashSet","set","Observable","observableProto","prototype","observableNever","never","observableThrow","throwException","AnonymousObservable","AnonymousObserver","notificationCreateOnNext","Notification","createOnNext","notificationCreateOnError","createOnError","notificationCreateOnCompleted","createOnCompleted","Observer","Subject","internals","helpers","ScheduledObserver","SerialDisposable","SingleAssignmentDisposable","CompositeDisposable","RefCountDisposable","disposableEmpty","Disposable","empty","immediateScheduler","Scheduler","immediate","addRef","defaultKeySerializer","isPromise","identity","inherits","bindCallback","isScheduler","noop","observableFromPromise","fromPromise","ArgumentOutOfRangeError","scheduleWithState","CheckedObserver","__super__","observer","_observer","_state","CheckedObserverPrototype","onNext","value","checkAccess","res","tryCatch","errorObj","thrower","e","onError","err","onCompleted","Error","ObserveOnObserver","cancel","_cancel","next","ensureActive","error","completed","checked","notifyOn","fromNotifier","handler","thisArg","handlerFunc","x","toNotifier","n","accept","asObserver","source","observeOn","subscribe","subscribeOn","m","d","setDisposable","schedule","generate","initialState","condition","iterate","resultSelector","currentThreadScheduler","o","first","scheduleRecursiveWithState","state","hasResult","result","using","resourceFactory","observableFactory","resource","exception","amb","rightSource","leftSource","choiceL","choice","leftChoice","rightSubscription","choiceR","rightChoice","leftSubscription","left","right","func","previous","current","acc","items","Array","isArray","arguments","push","onErrorResumeNext","second","sources","pos","subscription","cancelable","scheduleRecursive","bind","bufferWithCount","count","skip","windowWithCount","selectMany","toArray","where","Infinity","Math","abs","createWindow","q","refCountDisposable","c","shift","takeLastBuffer","defaultIfEmpty","defaultValue","found","retValue","distinct","keySelector","defaultComparer","hashSet","key"],"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,SAA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OE,UAAU,SAAUP,GAChC6E,GAAQ,EACR1G,EAASI,OAAOyB,IAElB,SAAUlB,GAAKX,EAASY,QAAQD,IAChC,YACG+F,GAAS1G,EAASI,OAAOqG,GAC1BzG,EAASc,iBAEVoB,IAePjF,EAAQI,UAAU0H,KAAO,SAAS1E,GAChC,GAAIsG,GAAoE,KAAzDjK,EAAqBtB,KAAK8B,IAAKmD,EAAOjF,KAAKyB,SAE1D,OADA8J,IAAYvL,KAAK8B,IAAI6H,KAAK1E,GACnBsG,GAeTvJ,EAAgBwJ,SAAW,SAAUC,EAAahK,GAChD,GAAIqF,GAAS9G,IAEb,OADAyB,KAAaA,EAAWiK,iBACjB,GAAIpJ,GAAoB,SAAUsF,GACvC,GAAI+D,GAAU,GAAI9J,GAAQJ,EAC1B,OAAOqF,GAAOE,UAAU,SAAUP,GAChC,GAAImF,GAAMnF,CAEV,IAAIgF,EACF,IACEG,EAAMH,EAAYhF,GAClB,MAAOlB,GAEP,WADAqC,GAAEpC,QAAQD,GAIdoG,EAAQhC,KAAKiC,IAAQhE,EAAE5C,OAAOyB,IAEhC,SAAUlB,GAAKqC,EAAEpC,QAAQD,IAAO,WAAcqC,EAAElC,iBAC/C1F,OAGIU"}
|
@@ -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={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("
|
2
|
+
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx-lite"],function(b,d){return a(c,d,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("rx-lite")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function f(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function g(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function h(a){this.comparer=a,this.set=[]}var i=c.Observable,j=i.prototype,k=i.never,l=i.throwException,m=c.AnonymousObservable,n=c.AnonymousObserver,o=c.Notification.createOnNext,p=c.Notification.createOnError,q=c.Notification.createOnCompleted,r=c.Observer,s=c.Subject,t=c.internals,u=c.helpers,v=t.ScheduledObserver,w=c.SerialDisposable,x=c.SingleAssignmentDisposable,y=c.CompositeDisposable,z=c.RefCountDisposable,A=c.Disposable.empty,B=c.Scheduler.immediate,C=(u.defaultKeySerializer,c.internals.addRef),D=(u.identity,u.isPromise),E=t.inherits,F=t.bindCallback,G=(u.noop,c.Scheduler.isScheduler),H=i.fromPromise,I=c.ArgumentOutOfRangeError;e.prototype.dispose=function(){this.scheduler.scheduleWithState(this,f)};var J=function(a){function b(b){a.call(this),this._observer=b,this._state=0}E(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=tryCatch(this._observer.onNext).call(this._observer,a);this._state=0,b===errorObj&&thrower(b.e)},c.onError=function(a){this.checkAccess();var b=tryCatch(this._observer.onError).call(this._observer,a);this._state=2,b===errorObj&&thrower(b.e)},c.onCompleted=function(){this.checkAccess();var a=tryCatch(this._observer.onCompleted).call(this._observer);this._state=2,a===errorObj&&thrower(a.e)},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(r),K=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return E(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(v);r.prototype.checked=function(){return new J(this)},r.notifyOn=function(a){return new K(a,this)},r.fromNotifier=function(a,b){var c=F(a,b,1);return new n(function(a){return c(o(a))},function(a){return c(p(a))},function(){return c(q())})},r.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},r.prototype.asObserver=function(){var a=this;return new n(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})},j.observeOn=function(a){var b=this;return new m(function(c){return b.subscribe(new K(a,c))},b)},j.subscribeOn=function(a){var b=this;return new m(function(c){var d=new x,f=new w;return f.setDisposable(d),d.setDisposable(a.schedule(function(){f.setDisposable(new e(a,b.subscribe(c)))})),f},b)},i.generate=function(a,b,c,d,e){return G(e)||(e=currentThreadScheduler),new m(function(f){var g=!0;return e.scheduleRecursiveWithState(a,function(a,e){var h,i;try{g?g=!1:a=c(a),h=b(a),h&&(i=d(a))}catch(j){return f.onError(j)}h?(f.onNext(i),e(a)):f.onCompleted()})})},i.using=function(a,b){return new m(function(c){var d,e,f=A;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new y(l(g).subscribe(c),f)}return new y(e.subscribe(c),f)})},j.amb=function(a){var b=this;return new m(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new x,j=new x;return D(a)&&(a=H(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new y(i,j)})},i.amb=function(){function a(a,b){return a.amb(b)}var b=k(),c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(var d=0,e=arguments.length;e>d;d++)c.push(arguments[d]);for(var d=0,e=c.length;e>d;d++)b=a(b,c[d]);return b},j.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return L([this,a])};var L=i.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else for(var b=0,c=arguments.length;c>b;b++)a.push(arguments[b]);return new m(function(b){var c=0,d=new w,e=B.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],D(f)&&(f=H(f)),g=new x,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new y(d,e)})};return j.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},j.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new I;if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new I;return new m(function(d){function e(){var a=new s;i.push(a),d.onNext(C(a,g))}var f=new x,g=new z(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)},j.takeLastBuffer=function(a){var b=this;return new m(function(c){var d=[];return b.subscribe(function(b){d.push(b),d.length>a&&d.shift()},function(a){c.onError(a)},function(){c.onNext(d),c.onCompleted()})},b)},j.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new m(function(c){var d=!1;return b.subscribe(function(a){d=!0,c.onNext(a)},function(a){c.onError(a)},function(){!d&&c.onNext(a),c.onCompleted()})},b)},h.prototype.push=function(a){var b=-1===g(this.set,a,this.comparer);return b&&this.set.push(a),b},j.distinct=function(a,b){var c=this;return b||(b=defaultComparer),new m(function(d){var e=new h(b);return c.subscribe(function(b){var c=b;if(a)try{c=a(b)}catch(f){return void d.onError(f)}e.push(c)&&d.onNext(b)},function(a){d.onError(a)},function(){d.onCompleted()})},this)},c});
|
3
3
|
//# sourceMappingURL=rx.lite.extras.map
|
@@ -32,7 +32,6 @@
|
|
32
32
|
// Defaults
|
33
33
|
var noop = Rx.helpers.noop = function () { },
|
34
34
|
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
|
35
|
-
isScheduler = Rx.helpers.isScheduler = function (x) { return x instanceof Rx.Scheduler; },
|
36
35
|
identity = Rx.helpers.identity = function (x) { return x; },
|
37
36
|
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
|
38
37
|
just = Rx.helpers.just = function (value) { return function () { return value; }; },
|
@@ -60,12 +59,11 @@
|
|
60
59
|
return isFn;
|
61
60
|
}());
|
62
61
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
function cloneArray(arr) { for(var a = [], i = 0, len = arr.length; i < len; i++) { a.push(arr[i]); } return a;}
|
62
|
+
function cloneArray(arr) {
|
63
|
+
var len = arr.length, a = new Array(len);
|
64
|
+
for(var i = 0; i < len; i++) { a[i] = arr[i]; }
|
65
|
+
return a;
|
66
|
+
}
|
69
67
|
|
70
68
|
Rx.config.longStackSupport = false;
|
71
69
|
var hasStacks = false;
|
@@ -163,6 +161,44 @@
|
|
163
161
|
if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }
|
164
162
|
}
|
165
163
|
|
164
|
+
var EmptyError = Rx.EmptyError = function() {
|
165
|
+
this.message = 'Sequence contains no elements.';
|
166
|
+
Error.call(this);
|
167
|
+
};
|
168
|
+
EmptyError.prototype = Error.prototype;
|
169
|
+
|
170
|
+
var ObjectDisposedError = Rx.ObjectDisposedError = function() {
|
171
|
+
this.message = 'Object has been disposed';
|
172
|
+
Error.call(this);
|
173
|
+
};
|
174
|
+
ObjectDisposedError.prototype = Error.prototype;
|
175
|
+
|
176
|
+
var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () {
|
177
|
+
this.message = 'Argument out of range';
|
178
|
+
Error.call(this);
|
179
|
+
};
|
180
|
+
ArgumentOutOfRangeError.prototype = Error.prototype;
|
181
|
+
|
182
|
+
var NotSupportedError = Rx.NotSupportedError = function (message) {
|
183
|
+
this.message = message || 'This operation is not supported';
|
184
|
+
Error.call(this);
|
185
|
+
};
|
186
|
+
NotSupportedError.prototype = Error.prototype;
|
187
|
+
|
188
|
+
var NotImplementedError = Rx.NotImplementedError = function (message) {
|
189
|
+
this.message = message || 'This operation is not implemented';
|
190
|
+
Error.call(this);
|
191
|
+
};
|
192
|
+
NotImplementedError.prototype = Error.prototype;
|
193
|
+
|
194
|
+
var notImplemented = Rx.helpers.notImplemented = function () {
|
195
|
+
throw new NotImplementedError();
|
196
|
+
};
|
197
|
+
|
198
|
+
var notSupported = Rx.helpers.notSupported = function () {
|
199
|
+
throw new NotSupportedError();
|
200
|
+
};
|
201
|
+
|
166
202
|
// Shim in iterator support
|
167
203
|
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
|
168
204
|
'_es6shim_iterator_';
|
@@ -638,13 +674,17 @@
|
|
638
674
|
* @constructor
|
639
675
|
*/
|
640
676
|
var CompositeDisposable = Rx.CompositeDisposable = function () {
|
641
|
-
var args = [];
|
677
|
+
var args = [], i, len;
|
642
678
|
if (Array.isArray(arguments[0])) {
|
643
679
|
args = arguments[0];
|
680
|
+
len = args.length;
|
644
681
|
} else {
|
645
|
-
|
682
|
+
len = arguments.length;
|
646
683
|
args = new Array(len);
|
647
|
-
for(
|
684
|
+
for(i = 0; i < len; i++) { args[i] = arguments[i]; }
|
685
|
+
}
|
686
|
+
for(i = 0; i < len; i++) {
|
687
|
+
if (!isDisposable(args[i])) { throw new TypeError('Not a disposable'); }
|
648
688
|
}
|
649
689
|
this.disposables = args;
|
650
690
|
this.isDisposed = false;
|
@@ -731,51 +771,67 @@
|
|
731
771
|
*/
|
732
772
|
var disposableEmpty = Disposable.empty = { dispose: noop };
|
733
773
|
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
/**
|
743
|
-
* Gets the underlying disposable.
|
744
|
-
* @return The underlying disposable.
|
745
|
-
*/
|
746
|
-
booleanDisposablePrototype.getDisposable = function () {
|
747
|
-
return this.current;
|
748
|
-
};
|
774
|
+
/**
|
775
|
+
* Validates whether the given object is a disposable
|
776
|
+
* @param {Object} Object to test whether it has a dispose method
|
777
|
+
* @returns {Boolean} true if a disposable object, else false.
|
778
|
+
*/
|
779
|
+
var isDisposable = Disposable.isDisposable = function (d) {
|
780
|
+
return d && isFunction(d.dispose);
|
781
|
+
};
|
749
782
|
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
*/
|
754
|
-
booleanDisposablePrototype.setDisposable = function (value) {
|
755
|
-
var shouldDispose = this.isDisposed;
|
756
|
-
if (!shouldDispose) {
|
757
|
-
var old = this.current;
|
758
|
-
this.current = value;
|
759
|
-
}
|
760
|
-
old && old.dispose();
|
761
|
-
shouldDispose && value && value.dispose();
|
762
|
-
};
|
783
|
+
var checkDisposed = Disposable.checkDisposed = function (disposable) {
|
784
|
+
if (disposable.isDisposed) { throw new ObjectDisposedError(); }
|
785
|
+
};
|
763
786
|
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
787
|
+
// Single assignment
|
788
|
+
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () {
|
789
|
+
this.isDisposed = false;
|
790
|
+
this.current = null;
|
791
|
+
};
|
792
|
+
SingleAssignmentDisposable.prototype.getDisposable = function () {
|
793
|
+
return this.current;
|
794
|
+
};
|
795
|
+
SingleAssignmentDisposable.prototype.setDisposable = function (value) {
|
796
|
+
if (this.current) { throw new Error('Disposable has already been assigned'); }
|
797
|
+
var shouldDispose = this.isDisposed;
|
798
|
+
!shouldDispose && (this.current = value);
|
799
|
+
shouldDispose && value && value.dispose();
|
800
|
+
};
|
801
|
+
SingleAssignmentDisposable.prototype.dispose = function () {
|
802
|
+
if (!this.isDisposed) {
|
803
|
+
this.isDisposed = true;
|
804
|
+
var old = this.current;
|
805
|
+
this.current = null;
|
806
|
+
}
|
807
|
+
old && old.dispose();
|
808
|
+
};
|
775
809
|
|
776
|
-
|
777
|
-
|
778
|
-
|
810
|
+
// Multiple assignment disposable
|
811
|
+
var SerialDisposable = Rx.SerialDisposable = function () {
|
812
|
+
this.isDisposed = false;
|
813
|
+
this.current = null;
|
814
|
+
};
|
815
|
+
SerialDisposable.prototype.getDisposable = function () {
|
816
|
+
return this.current;
|
817
|
+
};
|
818
|
+
SerialDisposable.prototype.setDisposable = function (value) {
|
819
|
+
var shouldDispose = this.isDisposed;
|
820
|
+
if (!shouldDispose) {
|
821
|
+
var old = this.current;
|
822
|
+
this.current = value;
|
823
|
+
}
|
824
|
+
old && old.dispose();
|
825
|
+
shouldDispose && value && value.dispose();
|
826
|
+
};
|
827
|
+
SerialDisposable.prototype.dispose = function () {
|
828
|
+
if (!this.isDisposed) {
|
829
|
+
this.isDisposed = true;
|
830
|
+
var old = this.current;
|
831
|
+
this.current = null;
|
832
|
+
}
|
833
|
+
old && old.dispose();
|
834
|
+
};
|
779
835
|
|
780
836
|
/**
|
781
837
|
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
|
@@ -870,6 +926,11 @@
|
|
870
926
|
this._scheduleAbsolute = scheduleAbsolute;
|
871
927
|
}
|
872
928
|
|
929
|
+
/** Determines whether the given object is a scheduler */
|
930
|
+
Scheduler.isScheduler = function (s) {
|
931
|
+
return s instanceof Scheduler;
|
932
|
+
}
|
933
|
+
|
873
934
|
function invokeAction(scheduler, action) {
|
874
935
|
action();
|
875
936
|
return disposableEmpty;
|
@@ -954,12 +1015,14 @@
|
|
954
1015
|
return Scheduler;
|
955
1016
|
}());
|
956
1017
|
|
957
|
-
var normalizeTime = Scheduler.normalize;
|
1018
|
+
var normalizeTime = Scheduler.normalize, isScheduler = Scheduler.isScheduler;
|
958
1019
|
|
959
1020
|
(function (schedulerProto) {
|
1021
|
+
|
960
1022
|
function invokeRecImmediate(scheduler, pair) {
|
961
|
-
var state = pair
|
962
|
-
|
1023
|
+
var state = pair[0], action = pair[1], group = new CompositeDisposable();
|
1024
|
+
|
1025
|
+
function recursiveAction(state1) {
|
963
1026
|
action(state1, function (state2) {
|
964
1027
|
var isAdded = false, isDone = false,
|
965
1028
|
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
|
@@ -976,14 +1039,15 @@
|
|
976
1039
|
isAdded = true;
|
977
1040
|
}
|
978
1041
|
});
|
979
|
-
}
|
1042
|
+
}
|
1043
|
+
|
980
1044
|
recursiveAction(state);
|
981
1045
|
return group;
|
982
1046
|
}
|
983
1047
|
|
984
1048
|
function invokeRecDate(scheduler, pair, method) {
|
985
|
-
var state = pair
|
986
|
-
|
1049
|
+
var state = pair[0], action = pair[1], group = new CompositeDisposable();
|
1050
|
+
function recursiveAction(state1) {
|
987
1051
|
action(state1, function (state2, dueTime1) {
|
988
1052
|
var isAdded = false, isDone = false,
|
989
1053
|
d = scheduler[method](state2, dueTime1, function (scheduler1, state3) {
|
@@ -1026,7 +1090,7 @@
|
|
1026
1090
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
1027
1091
|
*/
|
1028
1092
|
schedulerProto.scheduleRecursiveWithState = function (state, action) {
|
1029
|
-
return this.scheduleWithState(
|
1093
|
+
return this.scheduleWithState([state, action], invokeRecImmediate);
|
1030
1094
|
};
|
1031
1095
|
|
1032
1096
|
/**
|
@@ -1047,7 +1111,7 @@
|
|
1047
1111
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
1048
1112
|
*/
|
1049
1113
|
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
|
1050
|
-
return this._scheduleRelative(
|
1114
|
+
return this._scheduleRelative([state, action], dueTime, function (s, p) {
|
1051
1115
|
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
|
1052
1116
|
});
|
1053
1117
|
};
|
@@ -1070,7 +1134,7 @@
|
|
1070
1134
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
1071
1135
|
*/
|
1072
1136
|
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
|
1073
|
-
return this._scheduleAbsolute(
|
1137
|
+
return this._scheduleAbsolute([state, action], dueTime, function (s, p) {
|
1074
1138
|
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
|
1075
1139
|
});
|
1076
1140
|
};
|
@@ -1096,26 +1160,17 @@
|
|
1096
1160
|
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
|
1097
1161
|
*/
|
1098
1162
|
Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) {
|
1099
|
-
if (typeof root.setInterval === 'undefined') { throw new
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
s = action(s);
|
1104
|
-
}, period);
|
1105
|
-
|
1106
|
-
return disposableCreate(function () {
|
1107
|
-
root.clearInterval(id);
|
1108
|
-
});
|
1163
|
+
if (typeof root.setInterval === 'undefined') { throw new NotSupportedError(); }
|
1164
|
+
period = normalizeTime(period);
|
1165
|
+
var s = state, id = root.setInterval(function () { s = action(s); }, period);
|
1166
|
+
return disposableCreate(function () { root.clearInterval(id); });
|
1109
1167
|
};
|
1110
1168
|
|
1111
1169
|
}(Scheduler.prototype));
|
1112
1170
|
|
1113
1171
|
/** Gets a scheduler that schedules work immediately on the current thread. */
|
1114
1172
|
var immediateScheduler = Scheduler.immediate = (function () {
|
1115
|
-
|
1116
1173
|
function scheduleNow(state, action) { return action(this, state); }
|
1117
|
-
function notSupported() { throw new Error('Not supported'); }
|
1118
|
-
|
1119
1174
|
return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
|
1120
1175
|
}());
|
1121
1176
|
|
@@ -1125,12 +1180,10 @@
|
|
1125
1180
|
var currentThreadScheduler = Scheduler.currentThread = (function () {
|
1126
1181
|
var queue;
|
1127
1182
|
|
1128
|
-
function runTrampoline (
|
1129
|
-
while (
|
1130
|
-
var item =
|
1131
|
-
|
1132
|
-
!item.isCancelled() && item.invoke();
|
1133
|
-
}
|
1183
|
+
function runTrampoline () {
|
1184
|
+
while (queue.length > 0) {
|
1185
|
+
var item = queue.dequeue();
|
1186
|
+
!item.isCancelled() && item.invoke();
|
1134
1187
|
}
|
1135
1188
|
}
|
1136
1189
|
|
@@ -1140,27 +1193,18 @@
|
|
1140
1193
|
if (!queue) {
|
1141
1194
|
queue = new PriorityQueue(4);
|
1142
1195
|
queue.enqueue(si);
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
} finally {
|
1148
|
-
queue = null;
|
1149
|
-
}
|
1196
|
+
|
1197
|
+
var result = tryCatch(runTrampoline)();
|
1198
|
+
queue = null;
|
1199
|
+
if (result === errorObj) { return thrower(result.e); }
|
1150
1200
|
} else {
|
1151
1201
|
queue.enqueue(si);
|
1152
1202
|
}
|
1153
1203
|
return si.disposable;
|
1154
1204
|
}
|
1155
1205
|
|
1156
|
-
function notSupported() { throw new Error('Not supported'); }
|
1157
|
-
|
1158
1206
|
var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
|
1159
|
-
|
1160
1207
|
currentScheduler.scheduleRequired = function () { return !queue; };
|
1161
|
-
currentScheduler.ensureTrampoline = function (action) {
|
1162
|
-
if (!queue) { this.schedule(action); } else { action(); }
|
1163
|
-
};
|
1164
1208
|
|
1165
1209
|
return currentScheduler;
|
1166
1210
|
}());
|
@@ -1194,19 +1238,20 @@
|
|
1194
1238
|
return SchedulePeriodicRecursive;
|
1195
1239
|
}());
|
1196
1240
|
|
1197
|
-
var scheduleMethod, clearMethod
|
1241
|
+
var scheduleMethod, clearMethod;
|
1242
|
+
|
1198
1243
|
var localTimer = (function () {
|
1199
1244
|
var localSetTimeout, localClearTimeout = noop;
|
1200
|
-
if (
|
1245
|
+
if (!!root.setTimeout) {
|
1246
|
+
localSetTimeout = root.setTimeout;
|
1247
|
+
localClearTimeout = root.clearTimeout;
|
1248
|
+
} else if (!!root.WScript) {
|
1201
1249
|
localSetTimeout = function (fn, time) {
|
1202
|
-
WScript.Sleep(time);
|
1250
|
+
root.WScript.Sleep(time);
|
1203
1251
|
fn();
|
1204
1252
|
};
|
1205
|
-
} else if (!!root.setTimeout) {
|
1206
|
-
localSetTimeout = root.setTimeout;
|
1207
|
-
localClearTimeout = root.clearTimeout;
|
1208
1253
|
} else {
|
1209
|
-
throw new
|
1254
|
+
throw new NotSupportedError();
|
1210
1255
|
}
|
1211
1256
|
|
1212
1257
|
return {
|
@@ -1219,6 +1264,27 @@
|
|
1219
1264
|
|
1220
1265
|
(function () {
|
1221
1266
|
|
1267
|
+
var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false;
|
1268
|
+
|
1269
|
+
clearMethod = function (handle) {
|
1270
|
+
delete tasksByHandle[handle];
|
1271
|
+
};
|
1272
|
+
|
1273
|
+
function runTask(handle) {
|
1274
|
+
if (currentlyRunning) {
|
1275
|
+
localSetTimeout(function () { runTask(handle) }, 0);
|
1276
|
+
} else {
|
1277
|
+
var task = tasksByHandle[handle];
|
1278
|
+
if (task) {
|
1279
|
+
currentlyRunning = true;
|
1280
|
+
var result = tryCatch(task)();
|
1281
|
+
clearMethod(handle);
|
1282
|
+
currentlyRunning = false;
|
1283
|
+
if (result === errorObj) { return thrower(result.e); }
|
1284
|
+
}
|
1285
|
+
}
|
1286
|
+
}
|
1287
|
+
|
1222
1288
|
var reNative = RegExp('^' +
|
1223
1289
|
String(toString)
|
1224
1290
|
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
@@ -1226,15 +1292,12 @@
|
|
1226
1292
|
);
|
1227
1293
|
|
1228
1294
|
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
|
1229
|
-
!reNative.test(setImmediate) && setImmediate
|
1230
|
-
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
|
1231
|
-
!reNative.test(clearImmediate) && clearImmediate;
|
1295
|
+
!reNative.test(setImmediate) && setImmediate;
|
1232
1296
|
|
1233
1297
|
function postMessageSupported () {
|
1234
1298
|
// Ensure not in a worker
|
1235
1299
|
if (!root.postMessage || root.importScripts) { return false; }
|
1236
|
-
var isAsync = false,
|
1237
|
-
oldHandler = root.onmessage;
|
1300
|
+
var isAsync = false, oldHandler = root.onmessage;
|
1238
1301
|
// Test for async
|
1239
1302
|
root.onmessage = function () { isAsync = true; };
|
1240
1303
|
root.postMessage('', '*');
|
@@ -1244,85 +1307,96 @@
|
|
1244
1307
|
}
|
1245
1308
|
|
1246
1309
|
// Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
|
1247
|
-
if (
|
1248
|
-
scheduleMethod =
|
1249
|
-
|
1310
|
+
if (isFunction(setImmediate)) {
|
1311
|
+
scheduleMethod = function (action) {
|
1312
|
+
var id = nextHandle++;
|
1313
|
+
tasksByHandle[id] = action;
|
1314
|
+
setImmediate(function () { runTask(id); });
|
1315
|
+
|
1316
|
+
return id;
|
1317
|
+
};
|
1250
1318
|
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
|
1251
|
-
scheduleMethod =
|
1319
|
+
scheduleMethod = function (action) {
|
1320
|
+
var id = nextHandle++;
|
1321
|
+
tasksByHandle[id] = action;
|
1322
|
+
process.nextTick(function () { runTask(id); });
|
1323
|
+
|
1324
|
+
return id;
|
1325
|
+
};
|
1252
1326
|
} else if (postMessageSupported()) {
|
1253
|
-
var MSG_PREFIX = 'ms.rx.schedule' + Math.random()
|
1254
|
-
tasks = {},
|
1255
|
-
taskId = 0;
|
1327
|
+
var MSG_PREFIX = 'ms.rx.schedule' + Math.random();
|
1256
1328
|
|
1257
|
-
|
1329
|
+
function onGlobalPostMessage(event) {
|
1258
1330
|
// Only if we're a match to avoid any other global events
|
1259
1331
|
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
|
1260
|
-
|
1261
|
-
action = tasks[handleId];
|
1262
|
-
action();
|
1263
|
-
delete tasks[handleId];
|
1332
|
+
runTask(event.data.substring(MSG_PREFIX.length));
|
1264
1333
|
}
|
1265
1334
|
}
|
1266
1335
|
|
1267
1336
|
if (root.addEventListener) {
|
1268
1337
|
root.addEventListener('message', onGlobalPostMessage, false);
|
1338
|
+
} else if (root.attachEvent) {
|
1339
|
+
root.attachEvent('onmessage', onGlobalPostMessage);
|
1269
1340
|
} else {
|
1270
|
-
root.
|
1341
|
+
root.onmessage = onGlobalPostMessage;
|
1271
1342
|
}
|
1272
1343
|
|
1273
1344
|
scheduleMethod = function (action) {
|
1274
|
-
var
|
1275
|
-
|
1345
|
+
var id = nextHandle++;
|
1346
|
+
tasksByHandle[id] = action;
|
1276
1347
|
root.postMessage(MSG_PREFIX + currentId, '*');
|
1348
|
+
return id;
|
1277
1349
|
};
|
1278
1350
|
} else if (!!root.MessageChannel) {
|
1279
|
-
var channel = new root.MessageChannel()
|
1280
|
-
channelTasks = {},
|
1281
|
-
channelTaskId = 0;
|
1351
|
+
var channel = new root.MessageChannel();
|
1282
1352
|
|
1283
|
-
channel.port1.onmessage = function (
|
1284
|
-
var id = event.data,
|
1285
|
-
action = channelTasks[id];
|
1286
|
-
action();
|
1287
|
-
delete channelTasks[id];
|
1288
|
-
};
|
1353
|
+
channel.port1.onmessage = function (e) { runTask(e.data); };
|
1289
1354
|
|
1290
1355
|
scheduleMethod = function (action) {
|
1291
|
-
var id =
|
1292
|
-
|
1356
|
+
var id = nextHandle++;
|
1357
|
+
tasksByHandle[id] = action;
|
1293
1358
|
channel.port2.postMessage(id);
|
1359
|
+
return id;
|
1294
1360
|
};
|
1295
1361
|
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
|
1296
1362
|
|
1297
1363
|
scheduleMethod = function (action) {
|
1298
1364
|
var scriptElement = root.document.createElement('script');
|
1365
|
+
var id = nextHandle++;
|
1366
|
+
tasksByHandle[id] = action;
|
1367
|
+
|
1299
1368
|
scriptElement.onreadystatechange = function () {
|
1300
|
-
|
1369
|
+
runTask(id);
|
1301
1370
|
scriptElement.onreadystatechange = null;
|
1302
1371
|
scriptElement.parentNode.removeChild(scriptElement);
|
1303
1372
|
scriptElement = null;
|
1304
1373
|
};
|
1305
1374
|
root.document.documentElement.appendChild(scriptElement);
|
1375
|
+
return id;
|
1306
1376
|
};
|
1307
1377
|
|
1308
1378
|
} else {
|
1309
|
-
scheduleMethod = function (action) {
|
1310
|
-
|
1379
|
+
scheduleMethod = function (action) {
|
1380
|
+
var id = nextHandle++;
|
1381
|
+
tasksByHandle[id] = action;
|
1382
|
+
localSetTimeout(function () {
|
1383
|
+
runTask(id);
|
1384
|
+
}, 0);
|
1385
|
+
|
1386
|
+
return id;
|
1387
|
+
};
|
1311
1388
|
}
|
1312
1389
|
}());
|
1313
1390
|
|
1314
1391
|
/**
|
1315
1392
|
* Gets a scheduler that schedules work via a timed callback based upon platform.
|
1316
1393
|
*/
|
1317
|
-
var timeoutScheduler = Scheduler.timeout = (function () {
|
1394
|
+
var timeoutScheduler = Scheduler.timeout = Scheduler['default'] = (function () {
|
1318
1395
|
|
1319
1396
|
function scheduleNow(state, action) {
|
1320
|
-
var scheduler = this,
|
1321
|
-
disposable = new SingleAssignmentDisposable();
|
1397
|
+
var scheduler = this, disposable = new SingleAssignmentDisposable();
|
1322
1398
|
var id = scheduleMethod(function () {
|
1323
|
-
|
1324
|
-
disposable.setDisposable(action(scheduler, state));
|
1325
|
-
}
|
1399
|
+
!disposable.isDisposed && disposable.setDisposable(action(scheduler, state));
|
1326
1400
|
});
|
1327
1401
|
return new CompositeDisposable(disposable, disposableCreate(function () {
|
1328
1402
|
clearMethod(id);
|
@@ -1330,16 +1404,10 @@
|
|
1330
1404
|
}
|
1331
1405
|
|
1332
1406
|
function scheduleRelative(state, dueTime, action) {
|
1333
|
-
var scheduler = this,
|
1334
|
-
|
1335
|
-
if (dt === 0) {
|
1336
|
-
return scheduler.scheduleWithState(state, action);
|
1337
|
-
}
|
1338
|
-
var disposable = new SingleAssignmentDisposable();
|
1407
|
+
var scheduler = this, dt = Scheduler.normalize(dueTime), disposable = new SingleAssignmentDisposable();
|
1408
|
+
if (dt === 0) { return scheduler.scheduleWithState(state, action); }
|
1339
1409
|
var id = localSetTimeout(function () {
|
1340
|
-
|
1341
|
-
disposable.setDisposable(action(scheduler, state));
|
1342
|
-
}
|
1410
|
+
!disposable.isDisposed && disposable.setDisposable(action(scheduler, state));
|
1343
1411
|
}, dt);
|
1344
1412
|
return new CompositeDisposable(disposable, disposableCreate(function () {
|
1345
1413
|
localClearTimeout(id);
|
@@ -1357,9 +1425,13 @@
|
|
1357
1425
|
* Represents a notification to an observer.
|
1358
1426
|
*/
|
1359
1427
|
var Notification = Rx.Notification = (function () {
|
1360
|
-
function Notification(kind,
|
1361
|
-
this.hasValue = hasValue == null ? false : hasValue;
|
1428
|
+
function Notification(kind, value, exception, accept, acceptObservable, toString) {
|
1362
1429
|
this.kind = kind;
|
1430
|
+
this.value = value;
|
1431
|
+
this.exception = exception;
|
1432
|
+
this._accept = accept;
|
1433
|
+
this._acceptObservable = acceptObservable;
|
1434
|
+
this.toString = toString;
|
1363
1435
|
}
|
1364
1436
|
|
1365
1437
|
/**
|
@@ -1385,10 +1457,10 @@
|
|
1385
1457
|
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
|
1386
1458
|
*/
|
1387
1459
|
Notification.prototype.toObservable = function (scheduler) {
|
1388
|
-
var
|
1460
|
+
var self = this;
|
1389
1461
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
1390
1462
|
return new AnonymousObservable(function (observer) {
|
1391
|
-
return scheduler.
|
1463
|
+
return scheduler.scheduleWithState(self, function (_, notification) {
|
1392
1464
|
notification._acceptObservable(observer);
|
1393
1465
|
notification.kind === 'N' && observer.onCompleted();
|
1394
1466
|
});
|
@@ -1404,18 +1476,12 @@
|
|
1404
1476
|
* @returns {Notification} The OnNext notification containing the value.
|
1405
1477
|
*/
|
1406
1478
|
var notificationCreateOnNext = Notification.createOnNext = (function () {
|
1407
|
-
|
1408
|
-
function _accept (onNext) { return onNext(this.value); }
|
1479
|
+
function _accept(onNext) { return onNext(this.value); }
|
1409
1480
|
function _acceptObservable(observer) { return observer.onNext(this.value); }
|
1410
|
-
function toString
|
1481
|
+
function toString() { return 'OnNext(' + this.value + ')'; }
|
1411
1482
|
|
1412
1483
|
return function (value) {
|
1413
|
-
|
1414
|
-
notification.value = value;
|
1415
|
-
notification._accept = _accept;
|
1416
|
-
notification._acceptObservable = _acceptObservable;
|
1417
|
-
notification.toString = toString;
|
1418
|
-
return notification;
|
1484
|
+
return new Notification('N', value, null, _accept, _acceptObservable, toString);
|
1419
1485
|
};
|
1420
1486
|
}());
|
1421
1487
|
|
@@ -1425,18 +1491,12 @@
|
|
1425
1491
|
* @returns {Notification} The OnError notification containing the exception.
|
1426
1492
|
*/
|
1427
1493
|
var notificationCreateOnError = Notification.createOnError = (function () {
|
1428
|
-
|
1429
1494
|
function _accept (onNext, onError) { return onError(this.exception); }
|
1430
1495
|
function _acceptObservable(observer) { return observer.onError(this.exception); }
|
1431
1496
|
function toString () { return 'OnError(' + this.exception + ')'; }
|
1432
1497
|
|
1433
1498
|
return function (e) {
|
1434
|
-
|
1435
|
-
notification.exception = e;
|
1436
|
-
notification._accept = _accept;
|
1437
|
-
notification._acceptObservable = _acceptObservable;
|
1438
|
-
notification.toString = toString;
|
1439
|
-
return notification;
|
1499
|
+
return new Notification('E', null, e, _accept, _acceptObservable, toString);
|
1440
1500
|
};
|
1441
1501
|
}());
|
1442
1502
|
|
@@ -1445,17 +1505,12 @@
|
|
1445
1505
|
* @returns {Notification} The OnCompleted notification.
|
1446
1506
|
*/
|
1447
1507
|
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
|
1448
|
-
|
1449
1508
|
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
|
1450
1509
|
function _acceptObservable(observer) { return observer.onCompleted(); }
|
1451
1510
|
function toString () { return 'OnCompleted()'; }
|
1452
1511
|
|
1453
1512
|
return function () {
|
1454
|
-
|
1455
|
-
notification._accept = _accept;
|
1456
|
-
notification._acceptObservable = _acceptObservable;
|
1457
|
-
notification.toString = toString;
|
1458
|
-
return notification;
|
1513
|
+
return new Notification('C', null, null, _accept, _acceptObservable, toString);
|
1459
1514
|
};
|
1460
1515
|
}());
|
1461
1516
|
|
@@ -1675,10 +1730,6 @@
|
|
1675
1730
|
__super__.call(this);
|
1676
1731
|
}
|
1677
1732
|
|
1678
|
-
function notImplemented() {
|
1679
|
-
throw new Error('Method not implemented');
|
1680
|
-
}
|
1681
|
-
|
1682
1733
|
// Must be implemented by other observers
|
1683
1734
|
AbstractObserver.prototype.next = notImplemented;
|
1684
1735
|
AbstractObserver.prototype.error = notImplemented;
|
@@ -1921,25 +1972,21 @@
|
|
1921
1972
|
}(AbstractObserver));
|
1922
1973
|
|
1923
1974
|
var ObservableBase = Rx.ObservableBase = (function (__super__) {
|
1975
|
+
inherits(ObservableBase, __super__);
|
1924
1976
|
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
function fixSubscriber(subscriber) {
|
1929
|
-
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
|
1930
|
-
|
1931
|
-
return typeof subscriber === 'function' ?
|
1932
|
-
disposableCreate(subscriber) :
|
1933
|
-
disposableEmpty;
|
1977
|
+
function fixSubscriber(subscriber) {
|
1978
|
+
return subscriber && isFunction(subscriber.dispose) ? subscriber :
|
1979
|
+
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
|
1934
1980
|
}
|
1935
1981
|
|
1936
1982
|
function setDisposable(s, state) {
|
1937
1983
|
var ado = state[0], self = state[1];
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
if
|
1984
|
+
var sub = tryCatch(self.subscribeCore).call(self, ado);
|
1985
|
+
|
1986
|
+
if (sub === errorObj) {
|
1987
|
+
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
|
1942
1988
|
}
|
1989
|
+
ado.setDisposable(fixSubscriber(sub));
|
1943
1990
|
}
|
1944
1991
|
|
1945
1992
|
function subscribe(observer) {
|
@@ -1950,7 +1997,6 @@
|
|
1950
1997
|
} else {
|
1951
1998
|
setDisposable(null, state);
|
1952
1999
|
}
|
1953
|
-
|
1954
2000
|
return ado;
|
1955
2001
|
}
|
1956
2002
|
|
@@ -1958,12 +2004,9 @@
|
|
1958
2004
|
__super__.call(this, subscribe);
|
1959
2005
|
}
|
1960
2006
|
|
1961
|
-
ObservableBase.prototype.subscribeCore =
|
1962
|
-
throw new Error('Not implemeneted');
|
1963
|
-
}
|
2007
|
+
ObservableBase.prototype.subscribeCore = notImplemented;
|
1964
2008
|
|
1965
2009
|
return ObservableBase;
|
1966
|
-
|
1967
2010
|
}(Observable));
|
1968
2011
|
|
1969
2012
|
var ToArrayObservable = (function(__super__) {
|
@@ -2052,6 +2095,34 @@
|
|
2052
2095
|
});
|
2053
2096
|
};
|
2054
2097
|
|
2098
|
+
var EmptyObservable = (function(__super__) {
|
2099
|
+
inherits(EmptyObservable, __super__);
|
2100
|
+
function EmptyObservable(scheduler) {
|
2101
|
+
this.scheduler = scheduler;
|
2102
|
+
__super__.call(this);
|
2103
|
+
}
|
2104
|
+
|
2105
|
+
EmptyObservable.prototype.subscribeCore = function (observer) {
|
2106
|
+
var sink = new EmptySink(observer, this);
|
2107
|
+
return sink.run();
|
2108
|
+
};
|
2109
|
+
|
2110
|
+
function EmptySink(observer, parent) {
|
2111
|
+
this.observer = observer;
|
2112
|
+
this.parent = parent;
|
2113
|
+
}
|
2114
|
+
|
2115
|
+
function scheduleItem(s, state) {
|
2116
|
+
state.onCompleted();
|
2117
|
+
}
|
2118
|
+
|
2119
|
+
EmptySink.prototype.run = function () {
|
2120
|
+
return this.parent.scheduler.scheduleWithState(this.observer, scheduleItem);
|
2121
|
+
};
|
2122
|
+
|
2123
|
+
return EmptyObservable;
|
2124
|
+
}(ObservableBase));
|
2125
|
+
|
2055
2126
|
/**
|
2056
2127
|
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
|
2057
2128
|
*
|
@@ -2063,11 +2134,7 @@
|
|
2063
2134
|
*/
|
2064
2135
|
var observableEmpty = Observable.empty = function (scheduler) {
|
2065
2136
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
2066
|
-
return new
|
2067
|
-
return scheduler.schedule(function () {
|
2068
|
-
observer.onCompleted();
|
2069
|
-
});
|
2070
|
-
});
|
2137
|
+
return new EmptyObservable(scheduler);
|
2071
2138
|
};
|
2072
2139
|
|
2073
2140
|
var FromObservable = (function(__super__) {
|
@@ -2239,7 +2306,7 @@
|
|
2239
2306
|
inherits(FromArrayObservable, __super__);
|
2240
2307
|
function FromArrayObservable(args, scheduler) {
|
2241
2308
|
this.args = args;
|
2242
|
-
this.scheduler = scheduler
|
2309
|
+
this.scheduler = scheduler;
|
2243
2310
|
__super__.call(this);
|
2244
2311
|
}
|
2245
2312
|
|
@@ -2277,20 +2344,33 @@
|
|
2277
2344
|
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
|
2278
2345
|
*/
|
2279
2346
|
var observableFromArray = Observable.fromArray = function (array, scheduler) {
|
2347
|
+
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
|
2280
2348
|
return new FromArrayObservable(array, scheduler)
|
2281
2349
|
};
|
2282
2350
|
|
2351
|
+
var NeverObservable = (function(__super__) {
|
2352
|
+
inherits(NeverObservable, __super__);
|
2353
|
+
function NeverObservable() {
|
2354
|
+
__super__.call(this);
|
2355
|
+
}
|
2356
|
+
|
2357
|
+
NeverObservable.prototype.subscribeCore = function (observer) {
|
2358
|
+
return disposableEmpty;
|
2359
|
+
};
|
2360
|
+
|
2361
|
+
return NeverObservable;
|
2362
|
+
}(ObservableBase));
|
2363
|
+
|
2283
2364
|
/**
|
2284
|
-
*
|
2365
|
+
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
|
2285
2366
|
* @returns {Observable} An observable sequence whose observers will never get called.
|
2286
2367
|
*/
|
2287
2368
|
var observableNever = Observable.never = function () {
|
2288
|
-
return new
|
2289
|
-
return disposableEmpty;
|
2290
|
-
});
|
2369
|
+
return new NeverObservable();
|
2291
2370
|
};
|
2292
2371
|
|
2293
2372
|
function observableOf (scheduler, array) {
|
2373
|
+
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
|
2294
2374
|
return new FromArrayObservable(array, scheduler);
|
2295
2375
|
}
|
2296
2376
|
|
@@ -2301,7 +2381,7 @@
|
|
2301
2381
|
Observable.of = function () {
|
2302
2382
|
var len = arguments.length, args = new Array(len);
|
2303
2383
|
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
2304
|
-
return new FromArrayObservable(args);
|
2384
|
+
return new FromArrayObservable(args, currentThreadScheduler);
|
2305
2385
|
};
|
2306
2386
|
|
2307
2387
|
/**
|
@@ -2315,6 +2395,43 @@
|
|
2315
2395
|
return new FromArrayObservable(args, scheduler);
|
2316
2396
|
};
|
2317
2397
|
|
2398
|
+
var PairsObservable = (function(__super__) {
|
2399
|
+
inherits(PairsObservable, __super__);
|
2400
|
+
function PairsObservable(obj, scheduler) {
|
2401
|
+
this.obj = obj;
|
2402
|
+
this.keys = Object.keys(obj);
|
2403
|
+
this.scheduler = scheduler;
|
2404
|
+
__super__.call(this);
|
2405
|
+
}
|
2406
|
+
|
2407
|
+
PairsObservable.prototype.subscribeCore = function (observer) {
|
2408
|
+
var sink = new PairsSink(observer, this);
|
2409
|
+
return sink.run();
|
2410
|
+
};
|
2411
|
+
|
2412
|
+
return PairsObservable;
|
2413
|
+
}(ObservableBase));
|
2414
|
+
|
2415
|
+
function PairsSink(observer, parent) {
|
2416
|
+
this.observer = observer;
|
2417
|
+
this.parent = parent;
|
2418
|
+
}
|
2419
|
+
|
2420
|
+
PairsSink.prototype.run = function () {
|
2421
|
+
var observer = this.observer, obj = this.parent.obj, keys = this.parent.keys, len = keys.length;
|
2422
|
+
function loopRecursive(i, recurse) {
|
2423
|
+
if (i < len) {
|
2424
|
+
var key = keys[i];
|
2425
|
+
observer.onNext([key, obj[key]]);
|
2426
|
+
recurse(i + 1);
|
2427
|
+
} else {
|
2428
|
+
observer.onCompleted();
|
2429
|
+
}
|
2430
|
+
}
|
2431
|
+
|
2432
|
+
return this.parent.scheduler.scheduleRecursiveWithState(0, loopRecursive);
|
2433
|
+
};
|
2434
|
+
|
2318
2435
|
/**
|
2319
2436
|
* Convert an object into an observable sequence of [key, value] pairs.
|
2320
2437
|
* @param {Object} obj The object to inspect.
|
@@ -2322,19 +2439,8 @@
|
|
2322
2439
|
* @returns {Observable} An observable sequence of [key, value] pairs from the object.
|
2323
2440
|
*/
|
2324
2441
|
Observable.pairs = function (obj, scheduler) {
|
2325
|
-
scheduler || (scheduler =
|
2326
|
-
return new
|
2327
|
-
var keys = Object.keys(obj), len = keys.length;
|
2328
|
-
return scheduler.scheduleRecursiveWithState(0, function (idx, self) {
|
2329
|
-
if (idx < len) {
|
2330
|
-
var key = keys[idx];
|
2331
|
-
observer.onNext([key, obj[key]]);
|
2332
|
-
self(idx + 1);
|
2333
|
-
} else {
|
2334
|
-
observer.onCompleted();
|
2335
|
-
}
|
2336
|
-
});
|
2337
|
-
});
|
2442
|
+
scheduler || (scheduler = currentThreadScheduler);
|
2443
|
+
return new PairsObservable(obj, scheduler);
|
2338
2444
|
};
|
2339
2445
|
|
2340
2446
|
var RangeObservable = (function(__super__) {
|
@@ -2389,14 +2495,44 @@
|
|
2389
2495
|
return new RangeObservable(start, count, scheduler);
|
2390
2496
|
};
|
2391
2497
|
|
2498
|
+
var RepeatObservable = (function(__super__) {
|
2499
|
+
inherits(RepeatObservable, __super__);
|
2500
|
+
function RepeatObservable(value, repeatCount, scheduler) {
|
2501
|
+
this.value = value;
|
2502
|
+
this.repeatCount = repeatCount == null ? -1 : repeatCount;
|
2503
|
+
this.scheduler = scheduler;
|
2504
|
+
__super__.call(this);
|
2505
|
+
}
|
2506
|
+
|
2507
|
+
RepeatObservable.prototype.subscribeCore = function (observer) {
|
2508
|
+
var sink = new RepeatSink(observer, this);
|
2509
|
+
return sink.run();
|
2510
|
+
};
|
2511
|
+
|
2512
|
+
return RepeatObservable;
|
2513
|
+
}(ObservableBase));
|
2514
|
+
|
2515
|
+
function RepeatSink(observer, parent) {
|
2516
|
+
this.observer = observer;
|
2517
|
+
this.parent = parent;
|
2518
|
+
}
|
2519
|
+
|
2520
|
+
RepeatSink.prototype.run = function () {
|
2521
|
+
var observer = this.observer, value = this.parent.value;
|
2522
|
+
function loopRecursive(i, recurse) {
|
2523
|
+
if (i === -1 || i > 0) {
|
2524
|
+
observer.onNext(value);
|
2525
|
+
i > 0 && i--;
|
2526
|
+
}
|
2527
|
+
if (i === 0) { return observer.onCompleted(); }
|
2528
|
+
recurse(i);
|
2529
|
+
}
|
2530
|
+
|
2531
|
+
return this.parent.scheduler.scheduleRecursiveWithState(this.parent.repeatCount, loopRecursive);
|
2532
|
+
};
|
2533
|
+
|
2392
2534
|
/**
|
2393
2535
|
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
|
2394
|
-
*
|
2395
|
-
* @example
|
2396
|
-
* var res = Rx.Observable.repeat(42);
|
2397
|
-
* var res = Rx.Observable.repeat(42, 4);
|
2398
|
-
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
|
2399
|
-
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
|
2400
2536
|
* @param {Mixed} value Element to repeat.
|
2401
2537
|
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
|
2402
2538
|
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
|
@@ -2404,31 +2540,81 @@
|
|
2404
2540
|
*/
|
2405
2541
|
Observable.repeat = function (value, repeatCount, scheduler) {
|
2406
2542
|
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
|
2407
|
-
return
|
2543
|
+
return new RepeatObservable(value, repeatCount, scheduler);
|
2408
2544
|
};
|
2409
2545
|
|
2546
|
+
var JustObservable = (function(__super__) {
|
2547
|
+
inherits(JustObservable, __super__);
|
2548
|
+
function JustObservable(value, scheduler) {
|
2549
|
+
this.value = value;
|
2550
|
+
this.scheduler = scheduler;
|
2551
|
+
__super__.call(this);
|
2552
|
+
}
|
2553
|
+
|
2554
|
+
JustObservable.prototype.subscribeCore = function (observer) {
|
2555
|
+
var sink = new JustSink(observer, this);
|
2556
|
+
return sink.run();
|
2557
|
+
};
|
2558
|
+
|
2559
|
+
function JustSink(observer, parent) {
|
2560
|
+
this.observer = observer;
|
2561
|
+
this.parent = parent;
|
2562
|
+
}
|
2563
|
+
|
2564
|
+
function scheduleItem(s, state) {
|
2565
|
+
var value = state[0], observer = state[1];
|
2566
|
+
observer.onNext(value);
|
2567
|
+
observer.onCompleted();
|
2568
|
+
}
|
2569
|
+
|
2570
|
+
JustSink.prototype.run = function () {
|
2571
|
+
return this.parent.scheduler.scheduleWithState([this.parent.value, this.observer], scheduleItem);
|
2572
|
+
};
|
2573
|
+
|
2574
|
+
return JustObservable;
|
2575
|
+
}(ObservableBase));
|
2576
|
+
|
2410
2577
|
/**
|
2411
2578
|
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
|
2412
|
-
* There is an alias called 'just'
|
2579
|
+
* There is an alias called 'just' or browsers <IE9.
|
2413
2580
|
* @param {Mixed} value Single element in the resulting observable sequence.
|
2414
2581
|
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
|
2415
2582
|
* @returns {Observable} An observable sequence containing the single specified element.
|
2416
2583
|
*/
|
2417
|
-
var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {
|
2584
|
+
var observableReturn = Observable['return'] = Observable.just = Observable.returnValue = function (value, scheduler) {
|
2418
2585
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
2419
|
-
return new
|
2420
|
-
return scheduler.schedule(function () {
|
2421
|
-
observer.onNext(value);
|
2422
|
-
observer.onCompleted();
|
2423
|
-
});
|
2424
|
-
});
|
2586
|
+
return new JustObservable(value, scheduler);
|
2425
2587
|
};
|
2426
2588
|
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2430
|
-
|
2431
|
-
|
2589
|
+
var ThrowObservable = (function(__super__) {
|
2590
|
+
inherits(ThrowObservable, __super__);
|
2591
|
+
function ThrowObservable(error, scheduler) {
|
2592
|
+
this.error = error;
|
2593
|
+
this.scheduler = scheduler;
|
2594
|
+
__super__.call(this);
|
2595
|
+
}
|
2596
|
+
|
2597
|
+
ThrowObservable.prototype.subscribeCore = function (observer) {
|
2598
|
+
var sink = new ThrowSink(observer, this);
|
2599
|
+
return sink.run();
|
2600
|
+
};
|
2601
|
+
|
2602
|
+
function ThrowSink(observer, parent) {
|
2603
|
+
this.observer = observer;
|
2604
|
+
this.parent = parent;
|
2605
|
+
}
|
2606
|
+
|
2607
|
+
function scheduleItem(s, state) {
|
2608
|
+
var error = state[0], observer = state[1];
|
2609
|
+
observer.onError(error);
|
2610
|
+
}
|
2611
|
+
|
2612
|
+
ThrowSink.prototype.run = function () {
|
2613
|
+
return this.parent.scheduler.scheduleWithState([this.parent.error, this.observer], scheduleItem);
|
2614
|
+
};
|
2615
|
+
|
2616
|
+
return ThrowObservable;
|
2617
|
+
}(ObservableBase));
|
2432
2618
|
|
2433
2619
|
/**
|
2434
2620
|
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
|
@@ -2437,19 +2623,9 @@
|
|
2437
2623
|
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
|
2438
2624
|
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
|
2439
2625
|
*/
|
2440
|
-
var observableThrow = Observable['throw'] = Observable.throwError = function (error, scheduler) {
|
2626
|
+
var observableThrow = Observable['throw'] = Observable.throwError = Observable.throwException = function (error, scheduler) {
|
2441
2627
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
2442
|
-
return new
|
2443
|
-
return scheduler.schedule(function () {
|
2444
|
-
observer.onError(error);
|
2445
|
-
});
|
2446
|
-
});
|
2447
|
-
};
|
2448
|
-
|
2449
|
-
/** @deprecated use #some instead */
|
2450
|
-
Observable.throwException = function () {
|
2451
|
-
//deprecate('throwException', 'throwError');
|
2452
|
-
return Observable.throwError.apply(null, arguments);
|
2628
|
+
return new ThrowObservable(error, scheduler);
|
2453
2629
|
};
|
2454
2630
|
|
2455
2631
|
function observableCatchHandler(source, handler) {
|
@@ -2534,24 +2710,23 @@
|
|
2534
2710
|
var len = arguments.length, args = new Array(len);
|
2535
2711
|
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
2536
2712
|
var resultSelector = args.pop();
|
2537
|
-
len--;
|
2538
2713
|
Array.isArray(args[0]) && (args = args[0]);
|
2539
2714
|
|
2540
2715
|
return new AnonymousObservable(function (o) {
|
2541
|
-
var
|
2542
|
-
|
2716
|
+
var n = args.length,
|
2717
|
+
falseFactory = function () { return false; },
|
2718
|
+
hasValue = arrayInitialize(n, falseFactory),
|
2543
2719
|
hasValueAll = false,
|
2544
|
-
isDone = arrayInitialize(
|
2545
|
-
values = new Array(
|
2720
|
+
isDone = arrayInitialize(n, falseFactory),
|
2721
|
+
values = new Array(n);
|
2546
2722
|
|
2547
2723
|
function next(i) {
|
2548
2724
|
hasValue[i] = true;
|
2549
2725
|
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
|
2550
2726
|
try {
|
2551
2727
|
var res = resultSelector.apply(null, values);
|
2552
|
-
} catch (
|
2553
|
-
o.onError(
|
2554
|
-
return;
|
2728
|
+
} catch (e) {
|
2729
|
+
return o.onError(e);
|
2555
2730
|
}
|
2556
2731
|
o.onNext(res);
|
2557
2732
|
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
@@ -2564,8 +2739,8 @@
|
|
2564
2739
|
isDone.every(identity) && o.onCompleted();
|
2565
2740
|
}
|
2566
2741
|
|
2567
|
-
var subscriptions = new Array(
|
2568
|
-
for (var idx = 0; idx <
|
2742
|
+
var subscriptions = new Array(n);
|
2743
|
+
for (var idx = 0; idx < n; idx++) {
|
2569
2744
|
(function (i) {
|
2570
2745
|
var source = args[i], sad = new SingleAssignmentDisposable();
|
2571
2746
|
isPromise(source) && (source = observableFromPromise(source));
|
@@ -2618,52 +2793,131 @@
|
|
2618
2793
|
return this.merge(1);
|
2619
2794
|
};
|
2620
2795
|
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2625
|
-
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
|
2631
|
-
|
2632
|
-
|
2633
|
-
|
2634
|
-
|
2635
|
-
var activeCount = 0, group = new CompositeDisposable(), isStopped = false, q = [];
|
2796
|
+
var MergeObservable = (function (__super__) {
|
2797
|
+
inherits(MergeObservable, __super__);
|
2798
|
+
|
2799
|
+
function MergeObservable(source, maxConcurrent) {
|
2800
|
+
this.source = source;
|
2801
|
+
this.maxConcurrent = maxConcurrent;
|
2802
|
+
__super__.call(this);
|
2803
|
+
}
|
2804
|
+
|
2805
|
+
MergeObservable.prototype.subscribeCore = function(observer) {
|
2806
|
+
var g = new CompositeDisposable();
|
2807
|
+
g.add(this.source.subscribe(new MergeObserver(observer, this.maxConcurrent, g)));
|
2808
|
+
return g;
|
2809
|
+
};
|
2636
2810
|
|
2637
|
-
|
2638
|
-
var subscription = new SingleAssignmentDisposable();
|
2639
|
-
group.add(subscription);
|
2811
|
+
return MergeObservable;
|
2640
2812
|
|
2641
|
-
|
2642
|
-
isPromise(xs) && (xs = observableFromPromise(xs));
|
2813
|
+
}(ObservableBase));
|
2643
2814
|
|
2644
|
-
|
2645
|
-
|
2646
|
-
|
2647
|
-
|
2815
|
+
var MergeObserver = (function () {
|
2816
|
+
function MergeObserver(o, max, g) {
|
2817
|
+
this.o = o;
|
2818
|
+
this.max = max;
|
2819
|
+
this.g = g;
|
2820
|
+
this.done = false;
|
2821
|
+
this.q = [];
|
2822
|
+
this.activeCount = 0;
|
2823
|
+
this.isStopped = false;
|
2824
|
+
}
|
2825
|
+
MergeObserver.prototype.handleSubscribe = function (xs) {
|
2826
|
+
var sad = new SingleAssignmentDisposable();
|
2827
|
+
this.g.add(sad);
|
2828
|
+
isPromise(xs) && (xs = observableFromPromise(xs));
|
2829
|
+
sad.setDisposable(xs.subscribe(new InnerObserver(this, sad)));
|
2830
|
+
};
|
2831
|
+
MergeObserver.prototype.onNext = function (innerSource) {
|
2832
|
+
if (this.isStopped) { return; }
|
2833
|
+
if(this.activeCount < this.max) {
|
2834
|
+
this.activeCount++;
|
2835
|
+
this.handleSubscribe(innerSource);
|
2836
|
+
} else {
|
2837
|
+
this.q.push(innerSource);
|
2838
|
+
}
|
2839
|
+
};
|
2840
|
+
MergeObserver.prototype.onError = function (e) {
|
2841
|
+
if (!this.isStopped) {
|
2842
|
+
this.isStopped = true;
|
2843
|
+
this.o.onError(e);
|
2844
|
+
}
|
2845
|
+
};
|
2846
|
+
MergeObserver.prototype.onCompleted = function () {
|
2847
|
+
if (!this.isStopped) {
|
2848
|
+
this.isStopped = true;
|
2849
|
+
this.done = true;
|
2850
|
+
this.activeCount === 0 && this.o.onCompleted();
|
2851
|
+
}
|
2852
|
+
};
|
2853
|
+
MergeObserver.prototype.dispose = function() { this.isStopped = true; };
|
2854
|
+
MergeObserver.prototype.fail = function (e) {
|
2855
|
+
if (!this.isStopped) {
|
2856
|
+
this.isStopped = true;
|
2857
|
+
this.o.onError(e);
|
2858
|
+
return true;
|
2859
|
+
}
|
2860
|
+
|
2861
|
+
return false;
|
2862
|
+
};
|
2863
|
+
|
2864
|
+
function InnerObserver(parent, sad) {
|
2865
|
+
this.parent = parent;
|
2866
|
+
this.sad = sad;
|
2867
|
+
this.isStopped = false;
|
2868
|
+
}
|
2869
|
+
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.parent.o.onNext(x); } };
|
2870
|
+
InnerObserver.prototype.onError = function (e) {
|
2871
|
+
if (!this.isStopped) {
|
2872
|
+
this.isStopped = true;
|
2873
|
+
this.parent.o.onError(e);
|
2874
|
+
}
|
2875
|
+
};
|
2876
|
+
InnerObserver.prototype.onCompleted = function () {
|
2877
|
+
if(!this.isStopped) {
|
2878
|
+
this.isStopped = true;
|
2879
|
+
var parent = this.parent;
|
2880
|
+
parent.g.remove(this.sad);
|
2881
|
+
if (parent.q.length > 0) {
|
2882
|
+
parent.handleSubscribe(parent.q.shift());
|
2648
2883
|
} else {
|
2649
|
-
activeCount--;
|
2650
|
-
|
2884
|
+
parent.activeCount--;
|
2885
|
+
parent.done && parent.activeCount === 0 && parent.o.onCompleted();
|
2651
2886
|
}
|
2652
|
-
}));
|
2653
|
-
}
|
2654
|
-
group.add(sources.subscribe(function (innerSource) {
|
2655
|
-
if (activeCount < maxConcurrentOrOther) {
|
2656
|
-
activeCount++;
|
2657
|
-
subscribe(innerSource);
|
2658
|
-
} else {
|
2659
|
-
q.push(innerSource);
|
2660
2887
|
}
|
2661
|
-
}
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2666
|
-
|
2888
|
+
};
|
2889
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
2890
|
+
InnerObserver.prototype.fail = function (e) {
|
2891
|
+
if (!this.isStopped) {
|
2892
|
+
this.isStopped = true;
|
2893
|
+
this.parent.o.onError(e);
|
2894
|
+
return true;
|
2895
|
+
}
|
2896
|
+
|
2897
|
+
return false;
|
2898
|
+
};
|
2899
|
+
|
2900
|
+
return MergeObserver;
|
2901
|
+
}());
|
2902
|
+
|
2903
|
+
|
2904
|
+
|
2905
|
+
|
2906
|
+
|
2907
|
+
/**
|
2908
|
+
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
|
2909
|
+
* Or merges two observable sequences into a single observable sequence.
|
2910
|
+
*
|
2911
|
+
* @example
|
2912
|
+
* 1 - merged = sources.merge(1);
|
2913
|
+
* 2 - merged = source.merge(otherSource);
|
2914
|
+
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
|
2915
|
+
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
|
2916
|
+
*/
|
2917
|
+
observableProto.merge = function (maxConcurrentOrOther) {
|
2918
|
+
return typeof maxConcurrentOrOther !== 'number' ?
|
2919
|
+
observableMerge(this, maxConcurrentOrOther) :
|
2920
|
+
new MergeObservable(this, maxConcurrentOrOther);
|
2667
2921
|
};
|
2668
2922
|
|
2669
2923
|
/**
|
@@ -2689,35 +2943,188 @@
|
|
2689
2943
|
return observableOf(scheduler, sources).mergeAll();
|
2690
2944
|
};
|
2691
2945
|
|
2946
|
+
var CompositeError = Rx.CompositeError = function(errors) {
|
2947
|
+
this.name = "NotImplementedError";
|
2948
|
+
this.innerErrors = errors;
|
2949
|
+
this.message = 'This contains multiple errors. Check the innerErrors';
|
2950
|
+
Error.call(this);
|
2951
|
+
}
|
2952
|
+
CompositeError.prototype = Error.prototype;
|
2953
|
+
|
2692
2954
|
/**
|
2693
|
-
|
2694
|
-
|
2695
|
-
|
2696
|
-
|
2697
|
-
|
2955
|
+
* Flattens an Observable that emits Observables into one Observable, in a way that allows an Observer to
|
2956
|
+
* receive all successfully emitted items from all of the source Observables without being interrupted by
|
2957
|
+
* an error notification from one of them.
|
2958
|
+
*
|
2959
|
+
* This behaves like Observable.prototype.mergeAll except that if any of the merged Observables notify of an
|
2960
|
+
* error via the Observer's onError, mergeDelayError will refrain from propagating that
|
2961
|
+
* error notification until all of the merged Observables have finished emitting items.
|
2962
|
+
* @param {Array | Arguments} args Arguments or an array to merge.
|
2963
|
+
* @returns {Observable} an Observable that emits all of the items emitted by the Observables emitted by the Observable
|
2964
|
+
*/
|
2965
|
+
Observable.mergeDelayError = function() {
|
2966
|
+
var args;
|
2967
|
+
if (Array.isArray(arguments[0])) {
|
2968
|
+
args = arguments[0];
|
2969
|
+
} else {
|
2970
|
+
var len = arguments.length;
|
2971
|
+
args = new Array(len);
|
2972
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
2973
|
+
}
|
2974
|
+
var source = observableOf(null, args);
|
2975
|
+
|
2698
2976
|
return new AnonymousObservable(function (o) {
|
2699
2977
|
var group = new CompositeDisposable(),
|
2978
|
+
m = new SingleAssignmentDisposable(),
|
2700
2979
|
isStopped = false,
|
2701
|
-
|
2980
|
+
errors = [];
|
2981
|
+
|
2982
|
+
function setCompletion() {
|
2983
|
+
if (errors.length === 0) {
|
2984
|
+
o.onCompleted();
|
2985
|
+
} else if (errors.length === 1) {
|
2986
|
+
o.onError(errors[0]);
|
2987
|
+
} else {
|
2988
|
+
o.onError(new CompositeError(errors));
|
2989
|
+
}
|
2990
|
+
}
|
2702
2991
|
|
2703
2992
|
group.add(m);
|
2704
|
-
m.setDisposable(sources.subscribe(function (innerSource) {
|
2705
|
-
var innerSubscription = new SingleAssignmentDisposable();
|
2706
|
-
group.add(innerSubscription);
|
2707
2993
|
|
2708
|
-
|
2709
|
-
|
2994
|
+
m.setDisposable(source.subscribe(
|
2995
|
+
function (innerSource) {
|
2996
|
+
var innerSubscription = new SingleAssignmentDisposable();
|
2997
|
+
group.add(innerSubscription);
|
2710
2998
|
|
2711
|
-
|
2712
|
-
|
2713
|
-
|
2999
|
+
// Check for promises support
|
3000
|
+
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
3001
|
+
|
3002
|
+
innerSubscription.setDisposable(innerSource.subscribe(
|
3003
|
+
function (x) { o.onNext(x); },
|
3004
|
+
function (e) {
|
3005
|
+
errors.push(e);
|
3006
|
+
group.remove(innerSubscription);
|
3007
|
+
isStopped && group.length === 1 && setCompletion();
|
3008
|
+
},
|
3009
|
+
function () {
|
3010
|
+
group.remove(innerSubscription);
|
3011
|
+
isStopped && group.length === 1 && setCompletion();
|
3012
|
+
}));
|
3013
|
+
},
|
3014
|
+
function (e) {
|
3015
|
+
errors.push(e);
|
3016
|
+
isStopped = true;
|
3017
|
+
group.length === 1 && setCompletion();
|
3018
|
+
},
|
3019
|
+
function () {
|
3020
|
+
isStopped = true;
|
3021
|
+
group.length === 1 && setCompletion();
|
2714
3022
|
}));
|
2715
|
-
}, function (e) { o.onError(e); }, function () {
|
2716
|
-
isStopped = true;
|
2717
|
-
group.length === 1 && o.onCompleted();
|
2718
|
-
}));
|
2719
3023
|
return group;
|
2720
|
-
}
|
3024
|
+
});
|
3025
|
+
};
|
3026
|
+
|
3027
|
+
var MergeAllObservable = (function (__super__) {
|
3028
|
+
inherits(MergeAllObservable, __super__);
|
3029
|
+
|
3030
|
+
function MergeAllObservable(source) {
|
3031
|
+
this.source = source;
|
3032
|
+
__super__.call(this);
|
3033
|
+
}
|
3034
|
+
|
3035
|
+
MergeAllObservable.prototype.subscribeCore = function (observer) {
|
3036
|
+
var g = new CompositeDisposable(), m = new SingleAssignmentDisposable();
|
3037
|
+
g.add(m);
|
3038
|
+
m.setDisposable(this.source.subscribe(new MergeAllObserver(observer, g)));
|
3039
|
+
return g;
|
3040
|
+
};
|
3041
|
+
|
3042
|
+
return MergeAllObservable;
|
3043
|
+
}(ObservableBase));
|
3044
|
+
|
3045
|
+
var MergeAllObserver = (function() {
|
3046
|
+
|
3047
|
+
function MergeAllObserver(o, g) {
|
3048
|
+
this.o = o;
|
3049
|
+
this.g = g;
|
3050
|
+
this.isStopped = false;
|
3051
|
+
this.done = false;
|
3052
|
+
}
|
3053
|
+
MergeAllObserver.prototype.onNext = function(innerSource) {
|
3054
|
+
if(this.isStopped) { return; }
|
3055
|
+
var sad = new SingleAssignmentDisposable();
|
3056
|
+
this.g.add(sad);
|
3057
|
+
|
3058
|
+
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
3059
|
+
|
3060
|
+
sad.setDisposable(innerSource.subscribe(new InnerObserver(this, this.g, sad)));
|
3061
|
+
};
|
3062
|
+
MergeAllObserver.prototype.onError = function (e) {
|
3063
|
+
if(!this.isStopped) {
|
3064
|
+
this.isStopped = true;
|
3065
|
+
this.o.onError(e);
|
3066
|
+
}
|
3067
|
+
};
|
3068
|
+
MergeAllObserver.prototype.onCompleted = function () {
|
3069
|
+
if(!this.isStopped) {
|
3070
|
+
this.isStopped = true;
|
3071
|
+
this.done = true;
|
3072
|
+
this.g.length === 1 && this.o.onCompleted();
|
3073
|
+
}
|
3074
|
+
};
|
3075
|
+
MergeAllObserver.prototype.dispose = function() { this.isStopped = true; };
|
3076
|
+
MergeAllObserver.prototype.fail = function (e) {
|
3077
|
+
if (!this.isStopped) {
|
3078
|
+
this.isStopped = true;
|
3079
|
+
this.o.onError(e);
|
3080
|
+
return true;
|
3081
|
+
}
|
3082
|
+
|
3083
|
+
return false;
|
3084
|
+
};
|
3085
|
+
|
3086
|
+
function InnerObserver(parent, g, sad) {
|
3087
|
+
this.parent = parent;
|
3088
|
+
this.g = g;
|
3089
|
+
this.sad = sad;
|
3090
|
+
this.isStopped = false;
|
3091
|
+
}
|
3092
|
+
InnerObserver.prototype.onNext = function (x) { if (!this.isStopped) { this.parent.o.onNext(x); } };
|
3093
|
+
InnerObserver.prototype.onError = function (e) {
|
3094
|
+
if(!this.isStopped) {
|
3095
|
+
this.isStopped = true;
|
3096
|
+
this.parent.o.onError(e);
|
3097
|
+
}
|
3098
|
+
};
|
3099
|
+
InnerObserver.prototype.onCompleted = function () {
|
3100
|
+
if(!this.isStopped) {
|
3101
|
+
var parent = this.parent;
|
3102
|
+
this.isStopped = true;
|
3103
|
+
parent.g.remove(this.sad);
|
3104
|
+
parent.done && parent.g.length === 1 && parent.o.onCompleted();
|
3105
|
+
}
|
3106
|
+
};
|
3107
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
3108
|
+
InnerObserver.prototype.fail = function (e) {
|
3109
|
+
if (!this.isStopped) {
|
3110
|
+
this.isStopped = true;
|
3111
|
+
this.parent.o.onError(e);
|
3112
|
+
return true;
|
3113
|
+
}
|
3114
|
+
|
3115
|
+
return false;
|
3116
|
+
};
|
3117
|
+
|
3118
|
+
return MergeAllObserver;
|
3119
|
+
|
3120
|
+
}());
|
3121
|
+
|
3122
|
+
/**
|
3123
|
+
* Merges an observable sequence of observable sequences into an observable sequence.
|
3124
|
+
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
|
3125
|
+
*/
|
3126
|
+
observableProto.mergeAll = observableProto.mergeObservable = function () {
|
3127
|
+
return new MergeAllObservable(this);
|
2721
3128
|
};
|
2722
3129
|
|
2723
3130
|
/**
|
@@ -2814,7 +3221,8 @@
|
|
2814
3221
|
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
2815
3222
|
*/
|
2816
3223
|
observableProto.withLatestFrom = function () {
|
2817
|
-
|
3224
|
+
var len = arguments.length, args = new Array(len)
|
3225
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
2818
3226
|
var resultSelector = args.pop(), source = this;
|
2819
3227
|
|
2820
3228
|
if (typeof source === 'undefined') {
|
@@ -3094,10 +3502,12 @@
|
|
3094
3502
|
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
3095
3503
|
*/
|
3096
3504
|
observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
|
3097
|
-
var source = this
|
3098
|
-
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
|
3099
|
-
observerOrOnNext;
|
3505
|
+
var source = this;
|
3100
3506
|
return new AnonymousObservable(function (observer) {
|
3507
|
+
var tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ?
|
3508
|
+
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
|
3509
|
+
observerOrOnNext;
|
3510
|
+
|
3101
3511
|
return source.subscribe(function (x) {
|
3102
3512
|
try {
|
3103
3513
|
tapObserver.onNext(x);
|
@@ -3313,6 +3723,7 @@
|
|
3313
3723
|
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
|
3314
3724
|
*/
|
3315
3725
|
observableProto.skipLast = function (count) {
|
3726
|
+
if (count < 0) { throw new ArgumentOutOfRangeError(); }
|
3316
3727
|
var source = this;
|
3317
3728
|
return new AnonymousObservable(function (o) {
|
3318
3729
|
var q = [];
|
@@ -3352,6 +3763,7 @@
|
|
3352
3763
|
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
|
3353
3764
|
*/
|
3354
3765
|
observableProto.takeLast = function (count) {
|
3766
|
+
if (count < 0) { throw new ArgumentOutOfRangeError(); }
|
3355
3767
|
var source = this;
|
3356
3768
|
return new AnonymousObservable(function (o) {
|
3357
3769
|
var q = [];
|
@@ -3422,7 +3834,7 @@
|
|
3422
3834
|
|
3423
3835
|
MapObservable.prototype.internalMap = function (selector, thisArg) {
|
3424
3836
|
var self = this;
|
3425
|
-
return new MapObservable(this.source, function (x, i, o) { return selector(self.selector(x, i, o), i, o); }, thisArg)
|
3837
|
+
return new MapObservable(this.source, function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }, thisArg)
|
3426
3838
|
};
|
3427
3839
|
|
3428
3840
|
MapObservable.prototype.subscribeCore = function (observer) {
|
@@ -3443,10 +3855,9 @@
|
|
3443
3855
|
|
3444
3856
|
MapObserver.prototype.onNext = function(x) {
|
3445
3857
|
if (this.isStopped) { return; }
|
3446
|
-
|
3447
|
-
|
3448
|
-
|
3449
|
-
return this.observer.onError(e);
|
3858
|
+
var result = tryCatch(this.selector).call(this, x, this.i++, this.source);
|
3859
|
+
if (result === errorObj) {
|
3860
|
+
return this.observer.onError(result.e);
|
3450
3861
|
}
|
3451
3862
|
this.observer.onNext(result);
|
3452
3863
|
};
|
@@ -3567,7 +3978,7 @@
|
|
3567
3978
|
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
|
3568
3979
|
*/
|
3569
3980
|
observableProto.skip = function (count) {
|
3570
|
-
if (count < 0) { throw new
|
3981
|
+
if (count < 0) { throw new ArgumentOutOfRangeError(); }
|
3571
3982
|
var source = this;
|
3572
3983
|
return new AnonymousObservable(function (o) {
|
3573
3984
|
var remaining = count;
|
@@ -3620,7 +4031,7 @@
|
|
3620
4031
|
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
|
3621
4032
|
*/
|
3622
4033
|
observableProto.take = function (count, scheduler) {
|
3623
|
-
if (count < 0) { throw new
|
4034
|
+
if (count < 0) { throw new ArgumentOutOfRangeError(); }
|
3624
4035
|
if (count === 0) { return observableEmpty(scheduler); }
|
3625
4036
|
var source = this;
|
3626
4037
|
return new AnonymousObservable(function (o) {
|
@@ -3679,7 +4090,7 @@
|
|
3679
4090
|
|
3680
4091
|
FilterObservable.prototype.internalFilter = function(predicate, thisArg) {
|
3681
4092
|
var self = this;
|
3682
|
-
return new FilterObservable(this.source, function(x, i, o) { return self.predicate(x, i, o) && predicate(x, i, o); }, thisArg);
|
4093
|
+
return new FilterObservable(this.source, function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }, thisArg);
|
3683
4094
|
};
|
3684
4095
|
|
3685
4096
|
return FilterObservable;
|
@@ -3696,10 +4107,9 @@
|
|
3696
4107
|
|
3697
4108
|
FilterObserver.prototype.onNext = function(x) {
|
3698
4109
|
if (this.isStopped) { return; }
|
3699
|
-
|
3700
|
-
|
3701
|
-
|
3702
|
-
return this.observer.onError(e);
|
4110
|
+
var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source);
|
4111
|
+
if (shouldYield === errorObj) {
|
4112
|
+
return this.observer.onError(shouldYield.e);
|
3703
4113
|
}
|
3704
4114
|
shouldYield && this.observer.onNext(x);
|
3705
4115
|
};
|
@@ -3740,17 +4150,19 @@
|
|
3740
4150
|
*/
|
3741
4151
|
Observable.fromCallback = function (func, context, selector) {
|
3742
4152
|
return function () {
|
3743
|
-
|
4153
|
+
var len = arguments.length, args = new Array(len)
|
4154
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
3744
4155
|
|
3745
4156
|
return new AnonymousObservable(function (observer) {
|
3746
4157
|
function handler() {
|
3747
|
-
var results =
|
4158
|
+
var len = arguments.length, results = new Array(len);
|
4159
|
+
for(var i = 0; i < len; i++) { results[i] = arguments[i]; }
|
3748
4160
|
|
3749
4161
|
if (selector) {
|
3750
4162
|
try {
|
3751
|
-
results = selector(results);
|
3752
|
-
} catch (
|
3753
|
-
return observer.onError(
|
4163
|
+
results = selector.apply(context, results);
|
4164
|
+
} catch (e) {
|
4165
|
+
return observer.onError(e);
|
3754
4166
|
}
|
3755
4167
|
|
3756
4168
|
observer.onNext(results);
|
@@ -3780,7 +4192,8 @@
|
|
3780
4192
|
*/
|
3781
4193
|
Observable.fromNodeCallback = function (func, context, selector) {
|
3782
4194
|
return function () {
|
3783
|
-
|
4195
|
+
var len = arguments.length, args = new Array(len);
|
4196
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
3784
4197
|
|
3785
4198
|
return new AnonymousObservable(function (observer) {
|
3786
4199
|
function handler(err) {
|
@@ -3789,11 +4202,12 @@
|
|
3789
4202
|
return;
|
3790
4203
|
}
|
3791
4204
|
|
3792
|
-
|
4205
|
+
var len = arguments.length, results = [];
|
4206
|
+
for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; }
|
3793
4207
|
|
3794
4208
|
if (selector) {
|
3795
4209
|
try {
|
3796
|
-
results = selector(results);
|
4210
|
+
results = selector.apply(context, results);
|
3797
4211
|
} catch (e) {
|
3798
4212
|
return observer.onError(e);
|
3799
4213
|
}
|
@@ -3886,8 +4300,7 @@
|
|
3886
4300
|
try {
|
3887
4301
|
results = selector(arguments);
|
3888
4302
|
} catch (err) {
|
3889
|
-
observer.onError(err);
|
3890
|
-
return
|
4303
|
+
return observer.onError(err);
|
3891
4304
|
}
|
3892
4305
|
}
|
3893
4306
|
|
@@ -3911,8 +4324,7 @@
|
|
3911
4324
|
try {
|
3912
4325
|
result = selector(arguments);
|
3913
4326
|
} catch (err) {
|
3914
|
-
observer.onError(err);
|
3915
|
-
return;
|
4327
|
+
return observer.onError(err);
|
3916
4328
|
}
|
3917
4329
|
}
|
3918
4330
|
observer.onNext(result);
|
@@ -3960,7 +4372,7 @@
|
|
3960
4372
|
*/
|
3961
4373
|
observableProto.toPromise = function (promiseCtor) {
|
3962
4374
|
promiseCtor || (promiseCtor = Rx.config.Promise);
|
3963
|
-
if (!promiseCtor) { throw new
|
4375
|
+
if (!promiseCtor) { throw new NotSupportedError('Promise type not provided nor in Rx.config.Promise'); }
|
3964
4376
|
var source = this;
|
3965
4377
|
return new promiseCtor(function (resolve, reject) {
|
3966
4378
|
// No cancellation can be done
|
@@ -4101,14 +4513,14 @@
|
|
4101
4513
|
*
|
4102
4514
|
* @param selector [Optional] Selector function which can use the multicasted source sequence as many times as needed, without causing multiple subscriptions to the source sequence. Subscribers to the given source will receive all the notifications of the source subject to the specified replay buffer trimming policy.
|
4103
4515
|
* @param bufferSize [Optional] Maximum element count of the replay buffer.
|
4104
|
-
* @param
|
4516
|
+
* @param windowSize [Optional] Maximum time length of the replay buffer.
|
4105
4517
|
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
|
4106
4518
|
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
|
4107
4519
|
*/
|
4108
|
-
observableProto.replay = function (selector, bufferSize,
|
4520
|
+
observableProto.replay = function (selector, bufferSize, windowSize, scheduler) {
|
4109
4521
|
return selector && isFunction(selector) ?
|
4110
|
-
this.multicast(function () { return new ReplaySubject(bufferSize,
|
4111
|
-
this.multicast(new ReplaySubject(bufferSize,
|
4522
|
+
this.multicast(function () { return new ReplaySubject(bufferSize, windowSize, scheduler); }, selector) :
|
4523
|
+
this.multicast(new ReplaySubject(bufferSize, windowSize, scheduler));
|
4112
4524
|
};
|
4113
4525
|
|
4114
4526
|
/**
|
@@ -4126,8 +4538,8 @@
|
|
4126
4538
|
* @param scheduler [Optional] Scheduler where connected observers within the selector function will be invoked on.
|
4127
4539
|
* @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence.
|
4128
4540
|
*/
|
4129
|
-
observableProto.shareReplay = function (bufferSize,
|
4130
|
-
return this.replay(null, bufferSize,
|
4541
|
+
observableProto.shareReplay = function (bufferSize, windowSize, scheduler) {
|
4542
|
+
return this.replay(null, bufferSize, windowSize, scheduler).refCount();
|
4131
4543
|
};
|
4132
4544
|
|
4133
4545
|
var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
|
@@ -4400,9 +4812,9 @@
|
|
4400
4812
|
*
|
4401
4813
|
* @example
|
4402
4814
|
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
|
4403
|
-
* 2 - res = source.timestamp(Rx.Scheduler.
|
4815
|
+
* 2 - res = source.timestamp(Rx.Scheduler.default);
|
4404
4816
|
*
|
4405
|
-
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the
|
4817
|
+
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the default scheduler is used.
|
4406
4818
|
* @returns {Observable} An observable sequence with timestamp information on values.
|
4407
4819
|
*/
|
4408
4820
|
observableProto.timestamp = function (scheduler) {
|
@@ -4753,15 +5165,14 @@
|
|
4753
5165
|
return this.source.subscribe(observer);
|
4754
5166
|
}
|
4755
5167
|
|
4756
|
-
function ControlledObservable (source, enableQueue) {
|
5168
|
+
function ControlledObservable (source, enableQueue, scheduler) {
|
4757
5169
|
__super__.call(this, subscribe, source);
|
4758
|
-
this.subject = new ControlledSubject(enableQueue);
|
5170
|
+
this.subject = new ControlledSubject(enableQueue, scheduler);
|
4759
5171
|
this.source = source.multicast(this.subject).refCount();
|
4760
5172
|
}
|
4761
5173
|
|
4762
5174
|
ControlledObservable.prototype.request = function (numberOfItems) {
|
4763
|
-
|
4764
|
-
return this.subject.request(numberOfItems);
|
5175
|
+
return this.subject.request(numberOfItems == null ? -1 : numberOfItems);
|
4765
5176
|
};
|
4766
5177
|
|
4767
5178
|
return ControlledObservable;
|
@@ -4776,7 +5187,7 @@
|
|
4776
5187
|
|
4777
5188
|
inherits(ControlledSubject, __super__);
|
4778
5189
|
|
4779
|
-
function ControlledSubject(enableQueue) {
|
5190
|
+
function ControlledSubject(enableQueue, scheduler) {
|
4780
5191
|
enableQueue == null && (enableQueue = true);
|
4781
5192
|
|
4782
5193
|
__super__.call(this, subscribe);
|
@@ -4788,24 +5199,32 @@
|
|
4788
5199
|
this.error = null;
|
4789
5200
|
this.hasFailed = false;
|
4790
5201
|
this.hasCompleted = false;
|
4791
|
-
this.
|
5202
|
+
this.scheduler = scheduler || currentThreadScheduler;
|
4792
5203
|
}
|
4793
5204
|
|
4794
5205
|
addProperties(ControlledSubject.prototype, Observer, {
|
4795
5206
|
onCompleted: function () {
|
4796
5207
|
this.hasCompleted = true;
|
4797
|
-
(!this.enableQueue || this.queue.length === 0)
|
5208
|
+
if (!this.enableQueue || this.queue.length === 0) {
|
5209
|
+
this.subject.onCompleted();
|
5210
|
+
} else {
|
5211
|
+
this.queue.push(Notification.createOnCompleted());
|
5212
|
+
}
|
4798
5213
|
},
|
4799
5214
|
onError: function (error) {
|
4800
5215
|
this.hasFailed = true;
|
4801
5216
|
this.error = error;
|
4802
|
-
(!this.enableQueue || this.queue.length === 0)
|
5217
|
+
if (!this.enableQueue || this.queue.length === 0) {
|
5218
|
+
this.subject.onError(error);
|
5219
|
+
} else {
|
5220
|
+
this.queue.push(Notification.createOnError(error));
|
5221
|
+
}
|
4803
5222
|
},
|
4804
5223
|
onNext: function (value) {
|
4805
5224
|
var hasRequested = false;
|
4806
5225
|
|
4807
5226
|
if (this.requestedCount === 0) {
|
4808
|
-
this.enableQueue && this.queue.push(value);
|
5227
|
+
this.enableQueue && this.queue.push(Notification.createOnNext(value));
|
4809
5228
|
} else {
|
4810
5229
|
(this.requestedCount !== -1 && this.requestedCount-- === 0) && this.disposeCurrentRequest();
|
4811
5230
|
hasRequested = true;
|
@@ -4814,43 +5233,39 @@
|
|
4814
5233
|
},
|
4815
5234
|
_processRequest: function (numberOfItems) {
|
4816
5235
|
if (this.enableQueue) {
|
4817
|
-
while (this.queue.length >= numberOfItems && numberOfItems > 0)
|
4818
|
-
|
4819
|
-
|
5236
|
+
while ((this.queue.length >= numberOfItems && numberOfItems > 0) ||
|
5237
|
+
(this.queue.length > 0 && this.queue[0].kind !== 'N')) {
|
5238
|
+
var first = this.queue.shift();
|
5239
|
+
first.accept(this.subject);
|
5240
|
+
if (first.kind === 'N') {
|
5241
|
+
numberOfItems--;
|
5242
|
+
} else {
|
5243
|
+
this.disposeCurrentRequest();
|
5244
|
+
this.queue = [];
|
5245
|
+
}
|
4820
5246
|
}
|
4821
5247
|
|
4822
|
-
return this.queue.length !== 0
|
4823
|
-
{ numberOfItems: numberOfItems, returnValue: true } :
|
4824
|
-
{ numberOfItems: numberOfItems, returnValue: false };
|
4825
|
-
}
|
4826
|
-
|
4827
|
-
if (this.hasFailed) {
|
4828
|
-
this.subject.onError(this.error);
|
4829
|
-
this.controlledDisposable.dispose();
|
4830
|
-
this.controlledDisposable = disposableEmpty;
|
4831
|
-
} else if (this.hasCompleted) {
|
4832
|
-
this.subject.onCompleted();
|
4833
|
-
this.controlledDisposable.dispose();
|
4834
|
-
this.controlledDisposable = disposableEmpty;
|
5248
|
+
return { numberOfItems : numberOfItems, returnValue: this.queue.length !== 0};
|
4835
5249
|
}
|
4836
5250
|
|
4837
5251
|
return { numberOfItems: numberOfItems, returnValue: false };
|
4838
5252
|
},
|
4839
5253
|
request: function (number) {
|
4840
5254
|
this.disposeCurrentRequest();
|
4841
|
-
var self = this
|
5255
|
+
var self = this;
|
4842
5256
|
|
4843
|
-
|
4844
|
-
|
4845
|
-
|
4846
|
-
|
4847
|
-
self.requestedCount =
|
4848
|
-
|
5257
|
+
this.requestedDisposable = this.scheduler.scheduleWithState(number,
|
5258
|
+
function(s, i) {
|
5259
|
+
var r = self._processRequest(i), remaining = r.numberOfItems;
|
5260
|
+
if (!r.returnValue) {
|
5261
|
+
self.requestedCount = remaining;
|
5262
|
+
self.requestedDisposable = disposableCreate(function () {
|
5263
|
+
self.requestedCount = 0;
|
5264
|
+
});
|
5265
|
+
}
|
5266
|
+
});
|
4849
5267
|
|
4850
|
-
|
4851
|
-
} else {
|
4852
|
-
return disposableEmpty;
|
4853
|
-
}
|
5268
|
+
return this.requestedDisposable;
|
4854
5269
|
},
|
4855
5270
|
disposeCurrentRequest: function () {
|
4856
5271
|
this.requestedDisposable.dispose();
|
@@ -4866,12 +5281,51 @@
|
|
4866
5281
|
* @example
|
4867
5282
|
* var source = Rx.Observable.interval(100).controlled();
|
4868
5283
|
* source.request(3); // Reads 3 values
|
4869
|
-
* @param {
|
5284
|
+
* @param {bool} enableQueue truthy value to determine if values should be queued pending the next request
|
5285
|
+
* @param {Scheduler} scheduler determines how the requests will be scheduled
|
4870
5286
|
* @returns {Observable} The observable sequence which is paused based upon the pauser.
|
4871
5287
|
*/
|
4872
|
-
observableProto.controlled = function (enableQueue) {
|
5288
|
+
observableProto.controlled = function (enableQueue, scheduler) {
|
5289
|
+
|
5290
|
+
if (enableQueue && isScheduler(enableQueue)) {
|
5291
|
+
scheduler = enableQueue;
|
5292
|
+
enableQueue = true;
|
5293
|
+
}
|
5294
|
+
|
4873
5295
|
if (enableQueue == null) { enableQueue = true; }
|
4874
|
-
return new ControlledObservable(this, enableQueue);
|
5296
|
+
return new ControlledObservable(this, enableQueue, scheduler);
|
5297
|
+
};
|
5298
|
+
|
5299
|
+
/**
|
5300
|
+
* Pipes the existing Observable sequence into a Node.js Stream.
|
5301
|
+
* @param {Stream} dest The destination Node.js stream.
|
5302
|
+
* @returns {Stream} The destination stream.
|
5303
|
+
*/
|
5304
|
+
observableProto.pipe = function (dest) {
|
5305
|
+
var source = this.pausableBuffered();
|
5306
|
+
|
5307
|
+
function onDrain() {
|
5308
|
+
source.resume();
|
5309
|
+
}
|
5310
|
+
|
5311
|
+
dest.addListener('drain', onDrain);
|
5312
|
+
|
5313
|
+
source.subscribe(
|
5314
|
+
function (x) {
|
5315
|
+
!dest.write(String(x)) && source.pause();
|
5316
|
+
},
|
5317
|
+
function (err) {
|
5318
|
+
dest.emit('error', err);
|
5319
|
+
},
|
5320
|
+
function () {
|
5321
|
+
// Hack check because STDIO is not closable
|
5322
|
+
!dest._isStdio && dest.end();
|
5323
|
+
dest.removeListener('drain', onDrain);
|
5324
|
+
});
|
5325
|
+
|
5326
|
+
source.resume();
|
5327
|
+
|
5328
|
+
return dest;
|
4875
5329
|
};
|
4876
5330
|
|
4877
5331
|
/**
|
@@ -4882,32 +5336,32 @@
|
|
4882
5336
|
observableProto.transduce = function(transducer) {
|
4883
5337
|
var source = this;
|
4884
5338
|
|
4885
|
-
function transformForObserver(
|
5339
|
+
function transformForObserver(o) {
|
4886
5340
|
return {
|
4887
|
-
init: function() {
|
4888
|
-
return
|
5341
|
+
'@@transducer/init': function() {
|
5342
|
+
return o;
|
4889
5343
|
},
|
4890
|
-
step: function(obs, input) {
|
5344
|
+
'@@transducer/step': function(obs, input) {
|
4891
5345
|
return obs.onNext(input);
|
4892
5346
|
},
|
4893
|
-
result: function(obs) {
|
5347
|
+
'@@transducer/result': function(obs) {
|
4894
5348
|
return obs.onCompleted();
|
4895
5349
|
}
|
4896
5350
|
};
|
4897
5351
|
}
|
4898
5352
|
|
4899
|
-
return new AnonymousObservable(function(
|
4900
|
-
var xform = transducer(transformForObserver(
|
5353
|
+
return new AnonymousObservable(function(o) {
|
5354
|
+
var xform = transducer(transformForObserver(o));
|
4901
5355
|
return source.subscribe(
|
4902
5356
|
function(v) {
|
4903
5357
|
try {
|
4904
|
-
xform
|
5358
|
+
xform['@@transducer/step'](o, v);
|
4905
5359
|
} catch (e) {
|
4906
|
-
|
5360
|
+
o.onError(e);
|
4907
5361
|
}
|
4908
5362
|
},
|
4909
|
-
|
4910
|
-
function() { xform
|
5363
|
+
function (e) { o.onError(e); },
|
5364
|
+
function() { xform['@@transducer/result'](o); }
|
4911
5365
|
);
|
4912
5366
|
}, source);
|
4913
5367
|
};
|
@@ -4917,27 +5371,24 @@
|
|
4917
5371
|
|
4918
5372
|
// Fix subscriber to check for undefined or function returned to decorate as Disposable
|
4919
5373
|
function fixSubscriber(subscriber) {
|
4920
|
-
|
4921
|
-
|
4922
|
-
return typeof subscriber === 'function' ?
|
4923
|
-
disposableCreate(subscriber) :
|
4924
|
-
disposableEmpty;
|
5374
|
+
return subscriber && isFunction(subscriber.dispose) ? subscriber :
|
5375
|
+
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
|
4925
5376
|
}
|
4926
5377
|
|
4927
5378
|
function setDisposable(s, state) {
|
4928
5379
|
var ado = state[0], subscribe = state[1];
|
4929
|
-
|
4930
|
-
|
4931
|
-
|
4932
|
-
if
|
5380
|
+
var sub = tryCatch(subscribe)(ado);
|
5381
|
+
|
5382
|
+
if (sub === errorObj) {
|
5383
|
+
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
|
4933
5384
|
}
|
5385
|
+
ado.setDisposable(fixSubscriber(sub));
|
4934
5386
|
}
|
4935
5387
|
|
4936
5388
|
function AnonymousObservable(subscribe, parent) {
|
4937
5389
|
this.source = parent;
|
4938
5390
|
|
4939
5391
|
function s(observer) {
|
4940
|
-
|
4941
5392
|
var ado = new AutoDetachObserver(observer), state = [ado, subscribe];
|
4942
5393
|
|
4943
5394
|
if (currentThreadScheduler.scheduleRequired()) {
|
@@ -4945,7 +5396,6 @@
|
|
4945
5396
|
} else {
|
4946
5397
|
setDisposable(null, state);
|
4947
5398
|
}
|
4948
|
-
|
4949
5399
|
return ado;
|
4950
5400
|
}
|
4951
5401
|
|
@@ -4968,35 +5418,23 @@
|
|
4968
5418
|
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
|
4969
5419
|
|
4970
5420
|
AutoDetachObserverPrototype.next = function (value) {
|
4971
|
-
var
|
4972
|
-
|
4973
|
-
this.
|
4974
|
-
|
4975
|
-
} catch (e) {
|
4976
|
-
return thrower(e);
|
4977
|
-
} finally {
|
4978
|
-
!noError && this.dispose();
|
5421
|
+
var result = tryCatch(this.observer.onNext).call(this.observer, value);
|
5422
|
+
if (result === errorObj) {
|
5423
|
+
this.dispose();
|
5424
|
+
thrower(result.e);
|
4979
5425
|
}
|
4980
5426
|
};
|
4981
5427
|
|
4982
5428
|
AutoDetachObserverPrototype.error = function (err) {
|
4983
|
-
|
4984
|
-
|
4985
|
-
|
4986
|
-
return thrower(e);
|
4987
|
-
} finally {
|
4988
|
-
this.dispose();
|
4989
|
-
}
|
5429
|
+
var result = tryCatch(this.observer.onError).call(this.observer, err);
|
5430
|
+
this.dispose();
|
5431
|
+
result === errorObj && thrower(result.e);
|
4990
5432
|
};
|
4991
5433
|
|
4992
5434
|
AutoDetachObserverPrototype.completed = function () {
|
4993
|
-
|
4994
|
-
|
4995
|
-
|
4996
|
-
return thrower(e);
|
4997
|
-
} finally {
|
4998
|
-
this.dispose();
|
4999
|
-
}
|
5435
|
+
var result = tryCatch(this.observer.onCompleted).call(this.observer);
|
5436
|
+
this.dispose();
|
5437
|
+
result === errorObj && thrower(result.e);
|
5000
5438
|
};
|
5001
5439
|
|
5002
5440
|
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
|
@@ -5308,6 +5746,20 @@
|
|
5308
5746
|
}
|
5309
5747
|
|
5310
5748
|
addProperties(BehaviorSubject.prototype, Observer, {
|
5749
|
+
/**
|
5750
|
+
* Gets the current value or throws an exception.
|
5751
|
+
* Value is frozen after onCompleted is called.
|
5752
|
+
* After onError is called always throws the specified exception.
|
5753
|
+
* An exception is always thrown after dispose is called.
|
5754
|
+
* @returns {Mixed} The initial value passed to the constructor until onNext is called; after which, the last value passed to onNext.
|
5755
|
+
*/
|
5756
|
+
getValue: function () {
|
5757
|
+
checkDisposed(this);
|
5758
|
+
if (this.hasError) {
|
5759
|
+
throw this.error;
|
5760
|
+
}
|
5761
|
+
return this.value;
|
5762
|
+
},
|
5311
5763
|
/**
|
5312
5764
|
* Indicates whether the subject has observers subscribed to it.
|
5313
5765
|
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
|
@@ -5375,6 +5827,8 @@
|
|
5375
5827
|
*/
|
5376
5828
|
var ReplaySubject = Rx.ReplaySubject = (function (__super__) {
|
5377
5829
|
|
5830
|
+
var maxSafeInteger = Math.pow(2, 53) - 1;
|
5831
|
+
|
5378
5832
|
function createRemovableDisposable(subject, observer) {
|
5379
5833
|
return disposableCreate(function () {
|
5380
5834
|
observer.dispose();
|
@@ -5412,8 +5866,8 @@
|
|
5412
5866
|
* @param {Scheduler} [scheduler] Scheduler the observers are invoked on.
|
5413
5867
|
*/
|
5414
5868
|
function ReplaySubject(bufferSize, windowSize, scheduler) {
|
5415
|
-
this.bufferSize = bufferSize == null ?
|
5416
|
-
this.windowSize = windowSize == null ?
|
5869
|
+
this.bufferSize = bufferSize == null ? maxSafeInteger : bufferSize;
|
5870
|
+
this.windowSize = windowSize == null ? maxSafeInteger : windowSize;
|
5417
5871
|
this.scheduler = scheduler || currentThreadScheduler;
|
5418
5872
|
this.q = [];
|
5419
5873
|
this.observers = [];
|