rxjs-rails 2.5.2 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.js +367 -284
- data/vendor/assets/javascripts/rx.aggregates.map +1 -1
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.all.compat.js +2405 -2438
- data/vendor/assets/javascripts/rx.all.compat.map +1 -1
- data/vendor/assets/javascripts/rx.all.compat.min.js +4 -4
- data/vendor/assets/javascripts/rx.all.js +2380 -2395
- data/vendor/assets/javascripts/rx.all.map +1 -1
- data/vendor/assets/javascripts/rx.all.min.js +4 -4
- data/vendor/assets/javascripts/rx.async.compat.js +311 -333
- data/vendor/assets/javascripts/rx.async.compat.map +1 -1
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +280 -327
- data/vendor/assets/javascripts/rx.async.map +1 -1
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.backpressure.js +208 -176
- data/vendor/assets/javascripts/rx.backpressure.map +1 -1
- data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
- data/vendor/assets/javascripts/rx.binding.js +44 -27
- data/vendor/assets/javascripts/rx.binding.map +1 -1
- data/vendor/assets/javascripts/rx.binding.min.js +1 -1
- data/vendor/assets/javascripts/rx.coincidence.js +220 -453
- data/vendor/assets/javascripts/rx.coincidence.map +1 -1
- data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +1366 -1173
- data/vendor/assets/javascripts/rx.compat.map +1 -1
- data/vendor/assets/javascripts/rx.compat.min.js +3 -2
- data/vendor/assets/javascripts/rx.core.binding.js +823 -0
- data/vendor/assets/javascripts/rx.core.binding.map +1 -0
- data/vendor/assets/javascripts/rx.core.binding.min.js +3 -0
- data/vendor/assets/javascripts/rx.core.js +1281 -0
- data/vendor/assets/javascripts/rx.core.map +1 -0
- data/vendor/assets/javascripts/rx.core.min.js +3 -0
- data/vendor/assets/javascripts/rx.core.testing.js +1242 -0
- data/vendor/assets/javascripts/rx.core.testing.map +1 -0
- data/vendor/assets/javascripts/rx.core.testing.min.js +3 -0
- data/vendor/assets/javascripts/rx.experimental.js +85 -123
- data/vendor/assets/javascripts/rx.experimental.map +1 -1
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
- data/vendor/assets/javascripts/rx.joinpatterns.js +48 -37
- data/vendor/assets/javascripts/rx.joinpatterns.map +1 -1
- data/vendor/assets/javascripts/rx.joinpatterns.min.js +1 -1
- data/vendor/assets/javascripts/rx.js +1367 -1174
- data/vendor/assets/javascripts/rx.lite.compat.js +1621 -1403
- data/vendor/assets/javascripts/rx.lite.compat.map +1 -1
- data/vendor/assets/javascripts/rx.lite.compat.min.js +3 -3
- data/vendor/assets/javascripts/rx.lite.extras.compat.js +119 -89
- data/vendor/assets/javascripts/rx.lite.extras.compat.map +1 -1
- data/vendor/assets/javascripts/rx.lite.extras.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.lite.extras.js +119 -89
- data/vendor/assets/javascripts/rx.lite.extras.map +1 -1
- data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
- data/vendor/assets/javascripts/rx.lite.js +1583 -1390
- data/vendor/assets/javascripts/rx.lite.map +1 -1
- data/vendor/assets/javascripts/rx.lite.min.js +3 -3
- data/vendor/assets/javascripts/rx.map +1 -1
- data/vendor/assets/javascripts/rx.min.js +3 -2
- data/vendor/assets/javascripts/rx.sorting.js +23 -27
- data/vendor/assets/javascripts/rx.sorting.map +1 -1
- data/vendor/assets/javascripts/rx.sorting.min.js +1 -1
- data/vendor/assets/javascripts/rx.testing.js +11 -15
- data/vendor/assets/javascripts/rx.testing.map +1 -1
- data/vendor/assets/javascripts/rx.testing.min.js +1 -1
- data/vendor/assets/javascripts/rx.time.js +117 -133
- data/vendor/assets/javascripts/rx.time.map +1 -1
- data/vendor/assets/javascripts/rx.time.min.js +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.js +120 -39
- data/vendor/assets/javascripts/rx.virtualtime.map +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -1
- metadata +12 -3
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"rx.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,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,WAAY,SAAUE,EAAIR,GAC9B,MAAOZ,GAAQQ,EAAMI,EAASQ,KAET,gBAAXL,SAAuBA,QAAUA,OAAOH,UAAYD,EAClEI,OAAOH,QAAUZ,EAAQQ,EAAMO,OAAOH,QAASS,QAAQ,YAEvDb,EAAKY,GAAKpB,EAAQQ,KAAUA,EAAKY,MAEvCE,KAAKZ,KAAM,SAAUF,EAAMe,EAAKH,EAAIb,GAkCpC,QAASiB,GAAoBC,EAAWC,GACtChB,KAAKe,UAAYA,EACjBf,KAAKgB,WAAaA,EAClBhB,KAAKiB,YAAa,EAGpB,QAASC,GAAaC,EAAGC,GAClBA,EAAKH,aACRG,EAAKH,YAAa,EAClBG,EAAKJ,WAAWK,WA6epB,QAASC,GAAqBC,EAAOC,EAAMC,GACzC,IAAK,GAAIC,GAAI,EAAGC,EAAMJ,EAAMK,OAAYD,EAAJD,EAASA,IAC3C,GAAID,EAASF,EAAMG,GAAIF,GAAS,MAAOE,EAEzC,OAAO,GAGT,QAASG,GAAQJ,GACfzB,KAAKyB,SAAWA,EAChBzB,KAAK8B,OA9hBP,GAAIC,GAAarB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OjE,GAAOE,UAAU,SAAUP,GAChCsE,EAAEpB,KAAKlD,GACPsE,EAAEnJ,OAASyI,GAASU,EAAEG,SACrB,SAAU3F,GAAKqC,EAAEpC,QAAQD,IAAO,WACjCqC,EAAE5C,OAAO+F,GACTnD,EAAElC,iBAEHoB,IAaH9E,EAAgBoJ,eAAiB,SAAUC,GACzC,GAAIvE,GAAS9G,IAEb,OADAqL,KAAiBxL,IAAcwL,EAAe,MACvC,GAAI/I,GAAoB,SAAUsC,GACvC,GAAI0G,IAAQ,CACZ,OAAOxE,GAAOE,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
|
+
{"version":3,"file":"rx.lite.extras.min.js","sources":["rx.lite.extras.js"],"names":["factory","objectTypes","function","object","freeExports","exports","nodeType","freeSelf","self","Object","freeWindow","window","freeModule","module","freeGlobal","global","root","this","define","amd","Rx","require","call","exp","undefined","tryCatcher","tryCatchTarget","apply","arguments","e","errorObj","tryCatch","fn","isFunction","TypeError","thrower","ScheduledDisposable","scheduler","disposable","isDisposed","scheduleItem","s","dispose","amb","p","c","toArray","x","notEmpty","length","arrayIndexOfComparer","array","item","comparer","i","len","HashSet","set","Observable","observableProto","prototype","observableNever","never","observableThrow","AnonymousObservable","AnonymousObserver","notificationCreateOnNext","Notification","createOnNext","notificationCreateOnError","createOnError","notificationCreateOnCompleted","createOnCompleted","Observer","observerCreate","create","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","onError","err","onCompleted","Error","ObserveOnObserver","cancel","_cancel","next","ensureActive","error","completed","checked","notifyOn","fromNotifier","handler","thisArg","handlerFunc","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","rightSource","leftSource","choiceL","choice","leftChoice","rightSubscription","choiceR","rightChoice","leftSubscription","leftSubscribe","left","rightSubscribe","right","items","acc","Array","isArray","onErrorResumeNext","second","sources","push","pos","subscription","cancelable","scheduleRecursive","current","bind","bufferWithCount","count","skip","windowWithCount","flatMap","filter","Infinity","Math","abs","createWindow","q","refCountDisposable","shift","takeLastBuffer","defaultIfEmpty","defaultValue","found","retValue","distinct","keySelector","defaultComparer","hashSet","key","singleInstance","getObservable","hasObservable","observable","finally","publish","refCount"],"mappings":";CAEE,SAAUA,GACV,GAAIC,IACFC,YAAY,EACZC,QAAU,GAIVC,EAAc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GACvC,GAAI0D,GAAU,GAAIrJ,GAAQH,EAC1B,OAAOgF,GAAOE,UAAU,SAAUxF,GAChC,GAAI+J,GAAM/J,CAEV,IAAI4J,EACF,IACEG,EAAMH,EAAY5J,GAClB,MAAOlB,GAEP,WADAsH,GAAEnC,QAAQnF,GAIdgL,EAAQ5B,KAAK6B,IAAQ3D,EAAEvC,OAAO7D,IAEhC,SAAUlB,GAAKsH,EAAEnC,QAAQnF,IAAO,WAAcsH,EAAEjC,iBAC/CjG,OAQL0C,EAAgBoJ,eAAiB,WAG/B,QAASC,KAKP,MAJKC,KACHA,GAAgB,EAChBC,EAAa7E,EAAO8E,QAAQ,WAAaF,GAAgB,IAAUG,UAAUC,YAExEH,EAPT,GAA0CA,GAAtC7E,EAASpH,KAAMgM,GAAgB,CAUnC,OAAO,IAAIjJ,GAAoB,SAASmF,GACtC,MAAO6D,KAAgBzE,UAAUY,MAI9B/H"}
|
@@ -1,3 +1,3 @@
|
|
1
1
|
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
|
2
|
-
(function(a){var b={"
|
2
|
+
(function(a){var b={"function":!0,object:!0},c=b[typeof exports]&&exports&&!exports.nodeType&&exports,d=b[typeof self]&&self.Object&&self,e=b[typeof window]&&window&&window.Object&&window,f=b[typeof module]&&module&&!module.nodeType&&module,g=(f&&f.exports===c&&c,c&&f&&"object"==typeof global&&global&&global.Object&&global),h=h=g||e!==(this&&this.window)&&e||d||this;"function"==typeof define&&define.amd?define(["./rx.lite"],function(b,c){return a(h,c,b)}):"object"==typeof module&&module&&module.exports===c?module.exports=a(h,module.exports,require("rx-lite")):h.Rx=a(h,{},h.Rx)}).call(this,function(a,b,c,d){function e(){try{return o.apply(this,arguments)}catch(a){return S.e=a,S}}function f(a){if(!M(a))throw new TypeError("fn must be a function");return o=a,e}function g(a){throw a}function h(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function i(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function j(a,b){return a.amb(b)}function k(a){return a.toArray()}function l(a){return a.length>0}function m(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function n(a){this.comparer=a,this.set=[]}var o,p=c.Observable,q=p.prototype,r=p.never,s=p["throw"],t=c.AnonymousObservable,u=c.AnonymousObserver,v=c.Notification.createOnNext,w=c.Notification.createOnError,x=c.Notification.createOnCompleted,y=c.Observer,z=y.create,A=c.Subject,B=c.internals,C=c.helpers,D=B.ScheduledObserver,E=c.SerialDisposable,F=c.SingleAssignmentDisposable,G=c.CompositeDisposable,H=c.RefCountDisposable,I=c.Disposable.empty,J=c.Scheduler.immediate,K=(C.defaultKeySerializer,c.internals.addRef),L=(C.identity,C.isPromise),M=C.isFunction,N=B.inherits,O=B.bindCallback,P=(C.noop,c.Scheduler.isScheduler),Q=p.fromPromise,R=c.ArgumentOutOfRangeError,S={e:{}};h.prototype.dispose=function(){this.scheduler.scheduleWithState(this,i)};var T=function(a){function b(b){a.call(this),this._observer=b,this._state=0}N(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=f(this._observer.onNext).call(this._observer,a);this._state=0,b===S&&g(b.e)},c.onError=function(a){this.checkAccess();var b=f(this._observer.onError).call(this._observer,a);this._state=2,b===S&&g(b.e)},c.onCompleted=function(){this.checkAccess();var a=f(this._observer.onCompleted).call(this._observer);this._state=2,a===S&&g(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}(y),U=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return N(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}(D);y.prototype.checked=function(){return new T(this)},y.notifyOn=function(a){return new U(a,this)},y.fromNotifier=function(a,b){var c=O(a,b,1);return new u(function(a){return c(v(a))},function(a){return c(w(a))},function(){return c(x())})},y.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},y.prototype.asObserver=function(){var a=this;return new u(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})},q.observeOn=function(a){var b=this;return new t(function(c){return b.subscribe(new U(a,c))},b)},q.subscribeOn=function(a){var b=this;return new t(function(c){var d=new F,e=new E;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new h(a,b.subscribe(c)))})),e},b)},p.generate=function(a,b,c,d,e){return P(e)||(e=currentThreadScheduler),new t(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()})})},p.using=function(a,b){return new t(function(c){var d=I,e=f(a)();if(e===S)return new G(s(e.e).subscribe(c),d);e&&(d=e);var g=f(b)(e);return g===S?new G(s(g.e).subscribe(c),d):new G(g.subscribe(c),d)})},q.amb=function(a){var b=this;return new t(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new F,j=new F;L(a)&&(a=Q(a));var k=z(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()}),l=z(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()});return i.setDisposable(b.subscribe(k)),j.setDisposable(a.subscribe(l)),new G(i,j)})},p.amb=function(){var a,b=r();if(Array.isArray(arguments[0]))a=arguments[0];else{var c=arguments.length;a=new Array(a);for(var d=0;c>d;d++)a[d]=arguments[d]}for(var d=0,c=a.length;c>d;d++)b=j(b,a[d]);return b},q.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return V([this,a])};var V=p.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 t(function(b){var c=0,d=new E,e=J.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],L(f)&&(f=Q(f)),g=new F,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),e,e))):b.onCompleted()});return new G(d,e)})};return q.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).flatMap(k).filter(l)},q.windowWithCount=function(a,b){var c=this;if(+a||(a=0),1/0===Math.abs(a)&&(a=0),0>=a)throw new R;if(null==b&&(b=a),+b||(b=0),1/0===Math.abs(b)&&(b=0),0>=b)throw new R;return new t(function(d){function e(){var a=new A;i.push(a),d.onNext(K(a,g))}var f=new F,g=new H(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)},q.takeLastBuffer=function(a){var b=this;return new t(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)},q.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new t(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)},n.prototype.push=function(a){var b=-1===m(this.set,a,this.comparer);return b&&this.set.push(a),b},q.distinct=function(a,b){var c=this;return b||(b=defaultComparer),new t(function(d){var e=new n(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)},q.singleInstance=function(){function a(){return d||(d=!0,b=c.finally(function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new t(function(b){return a().subscribe(b)})},c});
|
3
3
|
//# sourceMappingURL=rx.lite.extras.map
|
@@ -3,46 +3,37 @@
|
|
3
3
|
;(function (undefined) {
|
4
4
|
|
5
5
|
var objectTypes = {
|
6
|
-
'boolean': false,
|
7
6
|
'function': true,
|
8
|
-
'object': true
|
9
|
-
'number': false,
|
10
|
-
'string': false,
|
11
|
-
'undefined': false
|
7
|
+
'object': true
|
12
8
|
};
|
13
9
|
|
14
|
-
var
|
10
|
+
var
|
15
11
|
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
|
12
|
+
freeSelf = objectTypes[typeof self] && self.Object && self,
|
13
|
+
freeWindow = objectTypes[typeof window] && window && window.Object && window,
|
16
14
|
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
|
17
15
|
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
|
18
|
-
freeGlobal =
|
16
|
+
freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
|
19
17
|
|
20
|
-
|
21
|
-
root = freeGlobal;
|
22
|
-
}
|
18
|
+
var root = root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
|
23
19
|
|
24
20
|
var Rx = {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
internals: {},
|
22
|
+
config: {
|
23
|
+
Promise: root.Promise
|
24
|
+
},
|
25
|
+
helpers: { }
|
30
26
|
};
|
31
27
|
|
32
28
|
// Defaults
|
33
29
|
var noop = Rx.helpers.noop = function () { },
|
34
|
-
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
|
35
30
|
identity = Rx.helpers.identity = function (x) { return x; },
|
36
|
-
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
|
37
|
-
just = Rx.helpers.just = function (value) { return function () { return value; }; },
|
38
31
|
defaultNow = Rx.helpers.defaultNow = Date.now,
|
39
32
|
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
|
40
33
|
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
|
41
34
|
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
|
42
35
|
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
|
43
|
-
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
|
44
|
-
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
|
45
|
-
not = Rx.helpers.not = function (a) { return !a; },
|
36
|
+
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; },
|
46
37
|
isFunction = Rx.helpers.isFunction = (function () {
|
47
38
|
|
48
39
|
var isFn = function (value) {
|
@@ -65,45 +56,59 @@
|
|
65
56
|
return a;
|
66
57
|
}
|
67
58
|
|
68
|
-
|
69
|
-
var
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
59
|
+
var errorObj = {e: {}};
|
60
|
+
var tryCatchTarget;
|
61
|
+
function tryCatcher() {
|
62
|
+
try {
|
63
|
+
return tryCatchTarget.apply(this, arguments);
|
64
|
+
} catch (e) {
|
65
|
+
errorObj.e = e;
|
66
|
+
return errorObj;
|
67
|
+
}
|
68
|
+
}
|
69
|
+
function tryCatch(fn) {
|
70
|
+
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
|
71
|
+
tryCatchTarget = fn;
|
72
|
+
return tryCatcher;
|
73
|
+
}
|
74
|
+
function thrower(e) {
|
75
|
+
throw e;
|
74
76
|
}
|
75
77
|
|
78
|
+
Rx.config.longStackSupport = false;
|
79
|
+
var hasStacks = false, stacks = tryCatch(function () { throw new Error(); })();
|
80
|
+
hasStacks = !!stacks.e && !!stacks.e.stack;
|
81
|
+
|
76
82
|
// All code after this point will be filtered from stack traces reported by RxJS
|
77
83
|
var rStartingLine = captureLine(), rFileName;
|
78
84
|
|
79
|
-
var STACK_JUMP_SEPARATOR =
|
85
|
+
var STACK_JUMP_SEPARATOR = 'From previous event:';
|
80
86
|
|
81
87
|
function makeStackTraceLong(error, observable) {
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
}
|
88
|
+
// If possible, transform the error stack trace by removing Node and RxJS
|
89
|
+
// cruft, then concatenating with the stack trace of `observable`.
|
90
|
+
if (hasStacks &&
|
91
|
+
observable.stack &&
|
92
|
+
typeof error === 'object' &&
|
93
|
+
error !== null &&
|
94
|
+
error.stack &&
|
95
|
+
error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
|
96
|
+
) {
|
97
|
+
var stacks = [];
|
98
|
+
for (var o = observable; !!o; o = o.source) {
|
99
|
+
if (o.stack) {
|
100
|
+
stacks.unshift(o.stack);
|
96
101
|
}
|
97
|
-
|
102
|
+
}
|
103
|
+
stacks.unshift(error.stack);
|
98
104
|
|
99
|
-
|
100
|
-
|
105
|
+
var concatedStacks = stacks.join('\n' + STACK_JUMP_SEPARATOR + '\n');
|
106
|
+
error.stack = filterStackString(concatedStacks);
|
101
107
|
}
|
102
108
|
}
|
103
109
|
|
104
110
|
function filterStackString(stackString) {
|
105
|
-
var lines = stackString.split(
|
106
|
-
desiredLines = [];
|
111
|
+
var lines = stackString.split('\n'), desiredLines = [];
|
107
112
|
for (var i = 0, len = lines.length; i < len; i++) {
|
108
113
|
var line = lines[i];
|
109
114
|
|
@@ -111,7 +116,7 @@
|
|
111
116
|
desiredLines.push(line);
|
112
117
|
}
|
113
118
|
}
|
114
|
-
return desiredLines.join(
|
119
|
+
return desiredLines.join('\n');
|
115
120
|
}
|
116
121
|
|
117
122
|
function isInternalFrame(stackLine) {
|
@@ -127,8 +132,8 @@
|
|
127
132
|
}
|
128
133
|
|
129
134
|
function isNodeFrame(stackLine) {
|
130
|
-
return stackLine.indexOf(
|
131
|
-
stackLine.indexOf(
|
135
|
+
return stackLine.indexOf('(module.js:') !== -1 ||
|
136
|
+
stackLine.indexOf('(node.js:') !== -1;
|
132
137
|
}
|
133
138
|
|
134
139
|
function captureLine() {
|
@@ -137,8 +142,8 @@
|
|
137
142
|
try {
|
138
143
|
throw new Error();
|
139
144
|
} catch (e) {
|
140
|
-
var lines = e.stack.split(
|
141
|
-
var firstLine = lines[0].indexOf(
|
145
|
+
var lines = e.stack.split('\n');
|
146
|
+
var firstLine = lines[0].indexOf('@') > 0 ? lines[1] : lines[2];
|
142
147
|
var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
|
143
148
|
if (!fileNameAndLineNumber) { return; }
|
144
149
|
|
@@ -148,45 +153,50 @@
|
|
148
153
|
}
|
149
154
|
|
150
155
|
function getFileNameAndLineNumber(stackLine) {
|
151
|
-
// Named functions:
|
156
|
+
// Named functions: 'at functionName (filename:lineNumber:columnNumber)'
|
152
157
|
var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
|
153
158
|
if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }
|
154
159
|
|
155
|
-
// Anonymous functions:
|
160
|
+
// Anonymous functions: 'at filename:lineNumber:columnNumber'
|
156
161
|
var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
|
157
162
|
if (attempt2) { return [attempt2[1], Number(attempt2[2])]; }
|
158
163
|
|
159
|
-
// Firefox style:
|
164
|
+
// Firefox style: 'function@filename:lineNumber or @filename:lineNumber'
|
160
165
|
var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
|
161
166
|
if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }
|
162
167
|
}
|
163
168
|
|
164
169
|
var EmptyError = Rx.EmptyError = function() {
|
165
170
|
this.message = 'Sequence contains no elements.';
|
171
|
+
this.name = 'EmptyError';
|
166
172
|
Error.call(this);
|
167
173
|
};
|
168
174
|
EmptyError.prototype = Error.prototype;
|
169
175
|
|
170
176
|
var ObjectDisposedError = Rx.ObjectDisposedError = function() {
|
171
177
|
this.message = 'Object has been disposed';
|
178
|
+
this.name = 'ObjectDisposedError';
|
172
179
|
Error.call(this);
|
173
180
|
};
|
174
181
|
ObjectDisposedError.prototype = Error.prototype;
|
175
182
|
|
176
183
|
var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () {
|
177
184
|
this.message = 'Argument out of range';
|
185
|
+
this.name = 'ArgumentOutOfRangeError';
|
178
186
|
Error.call(this);
|
179
187
|
};
|
180
188
|
ArgumentOutOfRangeError.prototype = Error.prototype;
|
181
189
|
|
182
190
|
var NotSupportedError = Rx.NotSupportedError = function (message) {
|
183
191
|
this.message = message || 'This operation is not supported';
|
192
|
+
this.name = 'NotSupportedError';
|
184
193
|
Error.call(this);
|
185
194
|
};
|
186
195
|
NotSupportedError.prototype = Error.prototype;
|
187
196
|
|
188
197
|
var NotImplementedError = Rx.NotImplementedError = function (message) {
|
189
198
|
this.message = message || 'This operation is not implemented';
|
199
|
+
this.name = 'NotImplementedError';
|
190
200
|
Error.call(this);
|
191
201
|
};
|
192
202
|
NotImplementedError.prototype = Error.prototype;
|
@@ -530,29 +540,10 @@
|
|
530
540
|
return result;
|
531
541
|
}
|
532
542
|
|
533
|
-
var errorObj = {e: {}};
|
534
|
-
var tryCatchTarget;
|
535
|
-
function tryCatcher() {
|
536
|
-
try {
|
537
|
-
return tryCatchTarget.apply(this, arguments);
|
538
|
-
} catch (e) {
|
539
|
-
errorObj.e = e;
|
540
|
-
return errorObj;
|
541
|
-
}
|
542
|
-
}
|
543
|
-
function tryCatch(fn) {
|
544
|
-
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
|
545
|
-
tryCatchTarget = fn;
|
546
|
-
return tryCatcher;
|
547
|
-
}
|
548
|
-
function thrower(e) {
|
549
|
-
throw e;
|
550
|
-
}
|
551
|
-
|
552
543
|
var hasProp = {}.hasOwnProperty,
|
553
544
|
slice = Array.prototype.slice;
|
554
545
|
|
555
|
-
var inherits =
|
546
|
+
var inherits = Rx.internals.inherits = function (child, parent) {
|
556
547
|
function __() { this.constructor = child; }
|
557
548
|
__.prototype = parent.prototype;
|
558
549
|
child.prototype = new __();
|
@@ -583,92 +574,6 @@
|
|
583
574
|
return a;
|
584
575
|
}
|
585
576
|
|
586
|
-
// Collections
|
587
|
-
function IndexedItem(id, value) {
|
588
|
-
this.id = id;
|
589
|
-
this.value = value;
|
590
|
-
}
|
591
|
-
|
592
|
-
IndexedItem.prototype.compareTo = function (other) {
|
593
|
-
var c = this.value.compareTo(other.value);
|
594
|
-
c === 0 && (c = this.id - other.id);
|
595
|
-
return c;
|
596
|
-
};
|
597
|
-
|
598
|
-
// Priority Queue for Scheduling
|
599
|
-
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
|
600
|
-
this.items = new Array(capacity);
|
601
|
-
this.length = 0;
|
602
|
-
};
|
603
|
-
|
604
|
-
var priorityProto = PriorityQueue.prototype;
|
605
|
-
priorityProto.isHigherPriority = function (left, right) {
|
606
|
-
return this.items[left].compareTo(this.items[right]) < 0;
|
607
|
-
};
|
608
|
-
|
609
|
-
priorityProto.percolate = function (index) {
|
610
|
-
if (index >= this.length || index < 0) { return; }
|
611
|
-
var parent = index - 1 >> 1;
|
612
|
-
if (parent < 0 || parent === index) { return; }
|
613
|
-
if (this.isHigherPriority(index, parent)) {
|
614
|
-
var temp = this.items[index];
|
615
|
-
this.items[index] = this.items[parent];
|
616
|
-
this.items[parent] = temp;
|
617
|
-
this.percolate(parent);
|
618
|
-
}
|
619
|
-
};
|
620
|
-
|
621
|
-
priorityProto.heapify = function (index) {
|
622
|
-
+index || (index = 0);
|
623
|
-
if (index >= this.length || index < 0) { return; }
|
624
|
-
var left = 2 * index + 1,
|
625
|
-
right = 2 * index + 2,
|
626
|
-
first = index;
|
627
|
-
if (left < this.length && this.isHigherPriority(left, first)) {
|
628
|
-
first = left;
|
629
|
-
}
|
630
|
-
if (right < this.length && this.isHigherPriority(right, first)) {
|
631
|
-
first = right;
|
632
|
-
}
|
633
|
-
if (first !== index) {
|
634
|
-
var temp = this.items[index];
|
635
|
-
this.items[index] = this.items[first];
|
636
|
-
this.items[first] = temp;
|
637
|
-
this.heapify(first);
|
638
|
-
}
|
639
|
-
};
|
640
|
-
|
641
|
-
priorityProto.peek = function () { return this.items[0].value; };
|
642
|
-
|
643
|
-
priorityProto.removeAt = function (index) {
|
644
|
-
this.items[index] = this.items[--this.length];
|
645
|
-
this.items[this.length] = undefined;
|
646
|
-
this.heapify();
|
647
|
-
};
|
648
|
-
|
649
|
-
priorityProto.dequeue = function () {
|
650
|
-
var result = this.peek();
|
651
|
-
this.removeAt(0);
|
652
|
-
return result;
|
653
|
-
};
|
654
|
-
|
655
|
-
priorityProto.enqueue = function (item) {
|
656
|
-
var index = this.length++;
|
657
|
-
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
|
658
|
-
this.percolate(index);
|
659
|
-
};
|
660
|
-
|
661
|
-
priorityProto.remove = function (item) {
|
662
|
-
for (var i = 0; i < this.length; i++) {
|
663
|
-
if (this.items[i].value === item) {
|
664
|
-
this.removeAt(i);
|
665
|
-
return true;
|
666
|
-
}
|
667
|
-
}
|
668
|
-
return false;
|
669
|
-
};
|
670
|
-
PriorityQueue.count = 0;
|
671
|
-
|
672
577
|
/**
|
673
578
|
* Represents a group of disposable resources that are disposed together.
|
674
579
|
* @constructor
|
@@ -1021,52 +926,62 @@
|
|
1021
926
|
|
1022
927
|
function invokeRecImmediate(scheduler, pair) {
|
1023
928
|
var state = pair[0], action = pair[1], group = new CompositeDisposable();
|
929
|
+
action(state, innerAction);
|
930
|
+
return group;
|
1024
931
|
|
1025
|
-
function
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
isAdded = true;
|
932
|
+
function innerAction(state2) {
|
933
|
+
var isAdded = false, isDone = false;
|
934
|
+
|
935
|
+
var d = scheduler.scheduleWithState(state2, scheduleWork);
|
936
|
+
if (!isDone) {
|
937
|
+
group.add(d);
|
938
|
+
isAdded = true;
|
939
|
+
}
|
940
|
+
|
941
|
+
function scheduleWork(_, state3) {
|
942
|
+
if (isAdded) {
|
943
|
+
group.remove(d);
|
944
|
+
} else {
|
945
|
+
isDone = true;
|
1040
946
|
}
|
1041
|
-
|
947
|
+
action(state3, innerAction);
|
948
|
+
return disposableEmpty;
|
949
|
+
}
|
1042
950
|
}
|
1043
|
-
|
1044
|
-
recursiveAction(state);
|
1045
|
-
return group;
|
1046
951
|
}
|
1047
952
|
|
1048
953
|
function invokeRecDate(scheduler, pair, method) {
|
1049
954
|
var state = pair[0], action = pair[1], group = new CompositeDisposable();
|
1050
|
-
|
1051
|
-
action(state1, function (state2, dueTime1) {
|
1052
|
-
var isAdded = false, isDone = false,
|
1053
|
-
d = scheduler[method](state2, dueTime1, function (scheduler1, state3) {
|
1054
|
-
if (isAdded) {
|
1055
|
-
group.remove(d);
|
1056
|
-
} else {
|
1057
|
-
isDone = true;
|
1058
|
-
}
|
1059
|
-
recursiveAction(state3);
|
1060
|
-
return disposableEmpty;
|
1061
|
-
});
|
1062
|
-
if (!isDone) {
|
1063
|
-
group.add(d);
|
1064
|
-
isAdded = true;
|
1065
|
-
}
|
1066
|
-
});
|
1067
|
-
};
|
1068
|
-
recursiveAction(state);
|
955
|
+
action(state, innerAction);
|
1069
956
|
return group;
|
957
|
+
|
958
|
+
function innerAction(state2, dueTime1) {
|
959
|
+
var isAdded = false, isDone = false;
|
960
|
+
|
961
|
+
var d = scheduler[method](state2, dueTime1, scheduleWork);
|
962
|
+
if (!isDone) {
|
963
|
+
group.add(d);
|
964
|
+
isAdded = true;
|
965
|
+
}
|
966
|
+
|
967
|
+
function scheduleWork(_, state3) {
|
968
|
+
if (isAdded) {
|
969
|
+
group.remove(d);
|
970
|
+
} else {
|
971
|
+
isDone = true;
|
972
|
+
}
|
973
|
+
action(state3, innerAction);
|
974
|
+
return disposableEmpty;
|
975
|
+
}
|
976
|
+
}
|
977
|
+
}
|
978
|
+
|
979
|
+
function invokeRecDateRelative(s, p) {
|
980
|
+
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
|
981
|
+
}
|
982
|
+
|
983
|
+
function invokeRecDateAbsolute(s, p) {
|
984
|
+
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
|
1070
985
|
}
|
1071
986
|
|
1072
987
|
function scheduleInnerRecursive(action, self) {
|
@@ -1079,8 +994,7 @@
|
|
1079
994
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
1080
995
|
*/
|
1081
996
|
schedulerProto.scheduleRecursive = function (action) {
|
1082
|
-
return this.scheduleRecursiveWithState(action,
|
1083
|
-
_action(function () { self(_action); }); });
|
997
|
+
return this.scheduleRecursiveWithState(action, scheduleInnerRecursive);
|
1084
998
|
};
|
1085
999
|
|
1086
1000
|
/**
|
@@ -1111,9 +1025,7 @@
|
|
1111
1025
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
1112
1026
|
*/
|
1113
1027
|
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
|
1114
|
-
return this._scheduleRelative([state, action], dueTime,
|
1115
|
-
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
|
1116
|
-
});
|
1028
|
+
return this._scheduleRelative([state, action], dueTime, invokeRecDateRelative);
|
1117
1029
|
};
|
1118
1030
|
|
1119
1031
|
/**
|
@@ -1134,9 +1046,7 @@
|
|
1134
1046
|
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
1135
1047
|
*/
|
1136
1048
|
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
|
1137
|
-
return this._scheduleAbsolute([state, action], dueTime,
|
1138
|
-
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
|
1139
|
-
});
|
1049
|
+
return this._scheduleAbsolute([state, action], dueTime, invokeRecDateAbsolute);
|
1140
1050
|
};
|
1141
1051
|
}(Scheduler.prototype));
|
1142
1052
|
|
@@ -1182,7 +1092,7 @@
|
|
1182
1092
|
|
1183
1093
|
function runTrampoline () {
|
1184
1094
|
while (queue.length > 0) {
|
1185
|
-
var item = queue.
|
1095
|
+
var item = queue.shift();
|
1186
1096
|
!item.isCancelled() && item.invoke();
|
1187
1097
|
}
|
1188
1098
|
}
|
@@ -1191,14 +1101,13 @@
|
|
1191
1101
|
var si = new ScheduledItem(this, state, action, this.now());
|
1192
1102
|
|
1193
1103
|
if (!queue) {
|
1194
|
-
queue =
|
1195
|
-
queue.enqueue(si);
|
1104
|
+
queue = [si];
|
1196
1105
|
|
1197
1106
|
var result = tryCatch(runTrampoline)();
|
1198
1107
|
queue = null;
|
1199
1108
|
if (result === errorObj) { return thrower(result.e); }
|
1200
1109
|
} else {
|
1201
|
-
queue.
|
1110
|
+
queue.push(si);
|
1202
1111
|
}
|
1203
1112
|
return si.disposable;
|
1204
1113
|
}
|
@@ -1514,188 +1423,6 @@
|
|
1514
1423
|
};
|
1515
1424
|
}());
|
1516
1425
|
|
1517
|
-
var Enumerator = Rx.internals.Enumerator = function (next) {
|
1518
|
-
this._next = next;
|
1519
|
-
};
|
1520
|
-
|
1521
|
-
Enumerator.prototype.next = function () {
|
1522
|
-
return this._next();
|
1523
|
-
};
|
1524
|
-
|
1525
|
-
Enumerator.prototype[$iterator$] = function () { return this; }
|
1526
|
-
|
1527
|
-
var Enumerable = Rx.internals.Enumerable = function (iterator) {
|
1528
|
-
this._iterator = iterator;
|
1529
|
-
};
|
1530
|
-
|
1531
|
-
Enumerable.prototype[$iterator$] = function () {
|
1532
|
-
return this._iterator();
|
1533
|
-
};
|
1534
|
-
|
1535
|
-
Enumerable.prototype.concat = function () {
|
1536
|
-
var sources = this;
|
1537
|
-
return new AnonymousObservable(function (o) {
|
1538
|
-
var e = sources[$iterator$]();
|
1539
|
-
|
1540
|
-
var isDisposed, subscription = new SerialDisposable();
|
1541
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1542
|
-
if (isDisposed) { return; }
|
1543
|
-
try {
|
1544
|
-
var currentItem = e.next();
|
1545
|
-
} catch (ex) {
|
1546
|
-
return o.onError(ex);
|
1547
|
-
}
|
1548
|
-
|
1549
|
-
if (currentItem.done) {
|
1550
|
-
return o.onCompleted();
|
1551
|
-
}
|
1552
|
-
|
1553
|
-
// Check if promise
|
1554
|
-
var currentValue = currentItem.value;
|
1555
|
-
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1556
|
-
|
1557
|
-
var d = new SingleAssignmentDisposable();
|
1558
|
-
subscription.setDisposable(d);
|
1559
|
-
d.setDisposable(currentValue.subscribe(
|
1560
|
-
function(x) { o.onNext(x); },
|
1561
|
-
function(err) { o.onError(err); },
|
1562
|
-
self)
|
1563
|
-
);
|
1564
|
-
});
|
1565
|
-
|
1566
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1567
|
-
isDisposed = true;
|
1568
|
-
}));
|
1569
|
-
});
|
1570
|
-
};
|
1571
|
-
|
1572
|
-
Enumerable.prototype.catchError = function () {
|
1573
|
-
var sources = this;
|
1574
|
-
return new AnonymousObservable(function (o) {
|
1575
|
-
var e = sources[$iterator$]();
|
1576
|
-
|
1577
|
-
var isDisposed, subscription = new SerialDisposable();
|
1578
|
-
var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) {
|
1579
|
-
if (isDisposed) { return; }
|
1580
|
-
|
1581
|
-
try {
|
1582
|
-
var currentItem = e.next();
|
1583
|
-
} catch (ex) {
|
1584
|
-
return observer.onError(ex);
|
1585
|
-
}
|
1586
|
-
|
1587
|
-
if (currentItem.done) {
|
1588
|
-
if (lastException !== null) {
|
1589
|
-
o.onError(lastException);
|
1590
|
-
} else {
|
1591
|
-
o.onCompleted();
|
1592
|
-
}
|
1593
|
-
return;
|
1594
|
-
}
|
1595
|
-
|
1596
|
-
// Check if promise
|
1597
|
-
var currentValue = currentItem.value;
|
1598
|
-
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1599
|
-
|
1600
|
-
var d = new SingleAssignmentDisposable();
|
1601
|
-
subscription.setDisposable(d);
|
1602
|
-
d.setDisposable(currentValue.subscribe(
|
1603
|
-
function(x) { o.onNext(x); },
|
1604
|
-
self,
|
1605
|
-
function() { o.onCompleted(); }));
|
1606
|
-
});
|
1607
|
-
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1608
|
-
isDisposed = true;
|
1609
|
-
}));
|
1610
|
-
});
|
1611
|
-
};
|
1612
|
-
|
1613
|
-
|
1614
|
-
Enumerable.prototype.catchErrorWhen = function (notificationHandler) {
|
1615
|
-
var sources = this;
|
1616
|
-
return new AnonymousObservable(function (o) {
|
1617
|
-
var exceptions = new Subject(),
|
1618
|
-
notifier = new Subject(),
|
1619
|
-
handled = notificationHandler(exceptions),
|
1620
|
-
notificationDisposable = handled.subscribe(notifier);
|
1621
|
-
|
1622
|
-
var e = sources[$iterator$]();
|
1623
|
-
|
1624
|
-
var isDisposed,
|
1625
|
-
lastException,
|
1626
|
-
subscription = new SerialDisposable();
|
1627
|
-
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1628
|
-
if (isDisposed) { return; }
|
1629
|
-
|
1630
|
-
try {
|
1631
|
-
var currentItem = e.next();
|
1632
|
-
} catch (ex) {
|
1633
|
-
return o.onError(ex);
|
1634
|
-
}
|
1635
|
-
|
1636
|
-
if (currentItem.done) {
|
1637
|
-
if (lastException) {
|
1638
|
-
o.onError(lastException);
|
1639
|
-
} else {
|
1640
|
-
o.onCompleted();
|
1641
|
-
}
|
1642
|
-
return;
|
1643
|
-
}
|
1644
|
-
|
1645
|
-
// Check if promise
|
1646
|
-
var currentValue = currentItem.value;
|
1647
|
-
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1648
|
-
|
1649
|
-
var outer = new SingleAssignmentDisposable();
|
1650
|
-
var inner = new SingleAssignmentDisposable();
|
1651
|
-
subscription.setDisposable(new CompositeDisposable(inner, outer));
|
1652
|
-
outer.setDisposable(currentValue.subscribe(
|
1653
|
-
function(x) { o.onNext(x); },
|
1654
|
-
function (exn) {
|
1655
|
-
inner.setDisposable(notifier.subscribe(self, function(ex) {
|
1656
|
-
o.onError(ex);
|
1657
|
-
}, function() {
|
1658
|
-
o.onCompleted();
|
1659
|
-
}));
|
1660
|
-
|
1661
|
-
exceptions.onNext(exn);
|
1662
|
-
},
|
1663
|
-
function() { o.onCompleted(); }));
|
1664
|
-
});
|
1665
|
-
|
1666
|
-
return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function () {
|
1667
|
-
isDisposed = true;
|
1668
|
-
}));
|
1669
|
-
});
|
1670
|
-
};
|
1671
|
-
|
1672
|
-
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
1673
|
-
if (repeatCount == null) { repeatCount = -1; }
|
1674
|
-
return new Enumerable(function () {
|
1675
|
-
var left = repeatCount;
|
1676
|
-
return new Enumerator(function () {
|
1677
|
-
if (left === 0) { return doneEnumerator; }
|
1678
|
-
if (left > 0) { left--; }
|
1679
|
-
return { done: false, value: value };
|
1680
|
-
});
|
1681
|
-
});
|
1682
|
-
};
|
1683
|
-
|
1684
|
-
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
|
1685
|
-
if (selector) {
|
1686
|
-
var selectorFn = bindCallback(selector, thisArg, 3);
|
1687
|
-
}
|
1688
|
-
return new Enumerable(function () {
|
1689
|
-
var index = -1;
|
1690
|
-
return new Enumerator(
|
1691
|
-
function () {
|
1692
|
-
return ++index < source.length ?
|
1693
|
-
{ done: false, value: !selector ? source[index] : selectorFn(source[index], index, source) } :
|
1694
|
-
doneEnumerator;
|
1695
|
-
});
|
1696
|
-
});
|
1697
|
-
};
|
1698
|
-
|
1699
1426
|
/**
|
1700
1427
|
* Supports push-style iteration over an observable sequence.
|
1701
1428
|
*/
|
@@ -1727,7 +1454,6 @@
|
|
1727
1454
|
*/
|
1728
1455
|
function AbstractObserver() {
|
1729
1456
|
this.isStopped = false;
|
1730
|
-
__super__.call(this);
|
1731
1457
|
}
|
1732
1458
|
|
1733
1459
|
// Must be implemented by other observers
|
@@ -1740,7 +1466,7 @@
|
|
1740
1466
|
* @param {Any} value Next element in the sequence.
|
1741
1467
|
*/
|
1742
1468
|
AbstractObserver.prototype.onNext = function (value) {
|
1743
|
-
|
1469
|
+
!this.isStopped && this.next(value);
|
1744
1470
|
};
|
1745
1471
|
|
1746
1472
|
/**
|
@@ -1767,9 +1493,7 @@
|
|
1767
1493
|
/**
|
1768
1494
|
* Disposes the observer, causing it to transition to the stopped state.
|
1769
1495
|
*/
|
1770
|
-
AbstractObserver.prototype.dispose = function () {
|
1771
|
-
this.isStopped = true;
|
1772
|
-
};
|
1496
|
+
AbstractObserver.prototype.dispose = function () { this.isStopped = true; };
|
1773
1497
|
|
1774
1498
|
AbstractObserver.prototype.fail = function (e) {
|
1775
1499
|
if (!this.isStopped) {
|
@@ -1836,25 +1560,23 @@
|
|
1836
1560
|
*/
|
1837
1561
|
var Observable = Rx.Observable = (function () {
|
1838
1562
|
|
1839
|
-
function
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
}
|
1846
|
-
|
1847
|
-
var self = this;
|
1848
|
-
this._subscribe = function (observer) {
|
1849
|
-
var oldOnError = observer.onError.bind(observer);
|
1563
|
+
function makeSubscribe(self, subscribe) {
|
1564
|
+
return function (o) {
|
1565
|
+
var oldOnError = o.onError;
|
1566
|
+
o.onError = function (e) {
|
1567
|
+
makeStackTraceLong(e, self);
|
1568
|
+
oldOnError.call(o, e);
|
1569
|
+
};
|
1850
1570
|
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
};
|
1571
|
+
return subscribe.call(self, o);
|
1572
|
+
};
|
1573
|
+
}
|
1855
1574
|
|
1856
|
-
|
1857
|
-
|
1575
|
+
function Observable(subscribe) {
|
1576
|
+
if (Rx.config.longStackSupport && hasStacks) {
|
1577
|
+
var e = tryCatch(thrower)(new Error()).e;
|
1578
|
+
this.stack = e.stack.substring(e.stack.indexOf('\n') + 1);
|
1579
|
+
this._subscribe = makeSubscribe(this, subscribe);
|
1858
1580
|
} else {
|
1859
1581
|
this._subscribe = subscribe;
|
1860
1582
|
}
|
@@ -1863,16 +1585,25 @@
|
|
1863
1585
|
observableProto = Observable.prototype;
|
1864
1586
|
|
1865
1587
|
/**
|
1866
|
-
|
1867
|
-
|
1588
|
+
* Determines whether the given object is an Observable
|
1589
|
+
* @param {Any} An object to determine whether it is an Observable
|
1590
|
+
* @returns {Boolean} true if an Observable, else false.
|
1591
|
+
*/
|
1592
|
+
Observable.isObservable = function (o) {
|
1593
|
+
return o && isFunction(o.subscribe);
|
1594
|
+
}
|
1595
|
+
|
1596
|
+
/**
|
1597
|
+
* Subscribes an o to the observable sequence.
|
1598
|
+
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
|
1868
1599
|
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
|
1869
1600
|
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
|
1870
1601
|
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
|
1871
1602
|
*/
|
1872
|
-
observableProto.subscribe = observableProto.forEach = function (
|
1873
|
-
return this._subscribe(typeof
|
1874
|
-
|
1875
|
-
observerCreate(
|
1603
|
+
observableProto.subscribe = observableProto.forEach = function (oOrOnNext, onError, onCompleted) {
|
1604
|
+
return this._subscribe(typeof oOrOnNext === 'object' ?
|
1605
|
+
oOrOnNext :
|
1606
|
+
observerCreate(oOrOnNext, onError, onCompleted));
|
1876
1607
|
};
|
1877
1608
|
|
1878
1609
|
/**
|
@@ -1937,13 +1668,13 @@
|
|
1937
1668
|
};
|
1938
1669
|
|
1939
1670
|
ScheduledObserver.prototype.ensureActive = function () {
|
1940
|
-
var isOwner = false
|
1671
|
+
var isOwner = false;
|
1941
1672
|
if (!this.hasFaulted && this.queue.length > 0) {
|
1942
1673
|
isOwner = !this.isAcquired;
|
1943
1674
|
this.isAcquired = true;
|
1944
1675
|
}
|
1945
1676
|
if (isOwner) {
|
1946
|
-
this.disposable.setDisposable(this.scheduler.
|
1677
|
+
this.disposable.setDisposable(this.scheduler.scheduleRecursiveWithState(this, function (parent, self) {
|
1947
1678
|
var work;
|
1948
1679
|
if (parent.queue.length > 0) {
|
1949
1680
|
work = parent.queue.shift();
|
@@ -1951,14 +1682,13 @@
|
|
1951
1682
|
parent.isAcquired = false;
|
1952
1683
|
return;
|
1953
1684
|
}
|
1954
|
-
|
1955
|
-
|
1956
|
-
} catch (ex) {
|
1685
|
+
var res = tryCatch(work)();
|
1686
|
+
if (res === errorObj) {
|
1957
1687
|
parent.queue = [];
|
1958
1688
|
parent.hasFaulted = true;
|
1959
|
-
|
1689
|
+
return thrower(res.e);
|
1960
1690
|
}
|
1961
|
-
self();
|
1691
|
+
self(parent);
|
1962
1692
|
}));
|
1963
1693
|
}
|
1964
1694
|
};
|
@@ -2009,50 +1739,338 @@
|
|
2009
1739
|
return ObservableBase;
|
2010
1740
|
}(Observable));
|
2011
1741
|
|
2012
|
-
|
2013
|
-
|
2014
|
-
|
2015
|
-
|
2016
|
-
|
1742
|
+
var FlatMapObservable = (function(__super__){
|
1743
|
+
|
1744
|
+
inherits(FlatMapObservable, __super__);
|
1745
|
+
|
1746
|
+
function FlatMapObservable(source, selector, resultSelector, thisArg) {
|
1747
|
+
this.resultSelector = Rx.helpers.isFunction(resultSelector) ?
|
1748
|
+
resultSelector : null;
|
1749
|
+
|
1750
|
+
this.selector = Rx.internals.bindCallback(Rx.helpers.isFunction(selector) ? selector : function() { return selector; }, thisArg, 3);
|
1751
|
+
this.source = source;
|
1752
|
+
|
1753
|
+
__super__.call(this);
|
1754
|
+
|
2017
1755
|
}
|
2018
1756
|
|
2019
|
-
|
2020
|
-
|
1757
|
+
FlatMapObservable.prototype.subscribeCore = function(o) {
|
1758
|
+
return this.source.subscribe(new InnerObserver(o, this.selector, this.resultSelector, this));
|
2021
1759
|
};
|
2022
1760
|
|
2023
|
-
|
1761
|
+
function InnerObserver(observer, selector, resultSelector, source) {
|
1762
|
+
this.i = 0;
|
1763
|
+
this.selector = selector;
|
1764
|
+
this.resultSelector = resultSelector;
|
1765
|
+
this.source = source;
|
1766
|
+
this.isStopped = false;
|
1767
|
+
this.o = observer;
|
1768
|
+
}
|
1769
|
+
|
1770
|
+
InnerObserver.prototype._wrapResult = function(result, x, i) {
|
1771
|
+
return this.resultSelector ?
|
1772
|
+
result.map(function(y, i2) { return this.resultSelector(x, y, i, i2); }, this) :
|
1773
|
+
result;
|
1774
|
+
};
|
1775
|
+
|
1776
|
+
InnerObserver.prototype.onNext = function(x) {
|
1777
|
+
|
1778
|
+
if (this.isStopped) return;
|
1779
|
+
|
1780
|
+
var i = this.i++;
|
1781
|
+
var result = tryCatch(this.selector)(x, i, this.source);
|
1782
|
+
|
1783
|
+
if (result === errorObj) {
|
1784
|
+
return this.o.onError(result.e);
|
1785
|
+
}
|
1786
|
+
|
1787
|
+
Rx.helpers.isPromise(result) && (result = Rx.Observable.fromPromise(result));
|
1788
|
+
(Rx.helpers.isArrayLike(result) || Rx.helpers.isIterable(result)) && (result = Rx.Observable.from(result));
|
1789
|
+
|
1790
|
+
this.o.onNext(this._wrapResult(result, x, i));
|
1791
|
+
|
1792
|
+
};
|
1793
|
+
|
1794
|
+
InnerObserver.prototype.onError = function(e) {
|
1795
|
+
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
|
1796
|
+
};
|
1797
|
+
|
1798
|
+
InnerObserver.prototype.onCompleted = function() {
|
1799
|
+
if (!this.isStopped) {this.isStopped = true; this.o.onCompleted(); }
|
1800
|
+
};
|
1801
|
+
|
1802
|
+
return FlatMapObservable;
|
1803
|
+
|
1804
|
+
}(ObservableBase));
|
1805
|
+
|
1806
|
+
var Enumerable = Rx.internals.Enumerable = function () { };
|
1807
|
+
|
1808
|
+
var ConcatEnumerableObservable = (function(__super__) {
|
1809
|
+
inherits(ConcatEnumerableObservable, __super__);
|
1810
|
+
function ConcatEnumerableObservable(sources) {
|
1811
|
+
this.sources = sources;
|
1812
|
+
__super__.call(this);
|
1813
|
+
}
|
1814
|
+
|
1815
|
+
ConcatEnumerableObservable.prototype.subscribeCore = function (o) {
|
1816
|
+
var isDisposed, subscription = new SerialDisposable();
|
1817
|
+
var cancelable = immediateScheduler.scheduleRecursiveWithState(this.sources[$iterator$](), function (e, self) {
|
1818
|
+
if (isDisposed) { return; }
|
1819
|
+
var currentItem = tryCatch(e.next).call(e);
|
1820
|
+
if (currentItem === errorObj) { return o.onError(currentItem.e); }
|
1821
|
+
|
1822
|
+
if (currentItem.done) {
|
1823
|
+
return o.onCompleted();
|
1824
|
+
}
|
1825
|
+
|
1826
|
+
// Check if promise
|
1827
|
+
var currentValue = currentItem.value;
|
1828
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1829
|
+
|
1830
|
+
var d = new SingleAssignmentDisposable();
|
1831
|
+
subscription.setDisposable(d);
|
1832
|
+
d.setDisposable(currentValue.subscribe(new InnerObserver(o, self, e)));
|
1833
|
+
});
|
1834
|
+
|
1835
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1836
|
+
isDisposed = true;
|
1837
|
+
}));
|
1838
|
+
};
|
1839
|
+
|
1840
|
+
function InnerObserver(o, s, e) {
|
1841
|
+
this.o = o;
|
1842
|
+
this.s = s;
|
1843
|
+
this.e = e;
|
1844
|
+
this.isStopped = false;
|
1845
|
+
}
|
1846
|
+
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.o.onNext(x); } };
|
1847
|
+
InnerObserver.prototype.onError = function (err) {
|
1848
|
+
if (!this.isStopped) {
|
1849
|
+
this.isStopped = true;
|
1850
|
+
this.o.onError(err);
|
1851
|
+
}
|
1852
|
+
};
|
1853
|
+
InnerObserver.prototype.onCompleted = function () {
|
1854
|
+
if (!this.isStopped) {
|
1855
|
+
this.isStopped = true;
|
1856
|
+
this.s(this.e);
|
1857
|
+
}
|
1858
|
+
};
|
1859
|
+
InnerObserver.prototype.dispose = function () { this.isStopped = true; };
|
1860
|
+
InnerObserver.prototype.fail = function (err) {
|
1861
|
+
if (!this.isStopped) {
|
1862
|
+
this.isStopped = true;
|
1863
|
+
this.o.onError(err);
|
1864
|
+
return true;
|
1865
|
+
}
|
1866
|
+
return false;
|
1867
|
+
};
|
1868
|
+
|
1869
|
+
return ConcatEnumerableObservable;
|
2024
1870
|
}(ObservableBase));
|
2025
1871
|
|
2026
|
-
function
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
this
|
2035
|
-
this.observer.onError(e);
|
1872
|
+
Enumerable.prototype.concat = function () {
|
1873
|
+
return new ConcatEnumerableObservable(this);
|
1874
|
+
};
|
1875
|
+
|
1876
|
+
var CatchErrorObservable = (function(__super__) {
|
1877
|
+
inherits(CatchErrorObservable, __super__);
|
1878
|
+
function CatchErrorObservable(sources) {
|
1879
|
+
this.sources = sources;
|
1880
|
+
__super__.call(this);
|
2036
1881
|
}
|
1882
|
+
|
1883
|
+
CatchErrorObservable.prototype.subscribeCore = function (o) {
|
1884
|
+
var e = this.sources[$iterator$]();
|
1885
|
+
|
1886
|
+
var isDisposed, subscription = new SerialDisposable();
|
1887
|
+
var cancelable = immediateScheduler.scheduleRecursiveWithState(null, function (lastException, self) {
|
1888
|
+
if (isDisposed) { return; }
|
1889
|
+
var currentItem = tryCatch(e.next).call(e);
|
1890
|
+
if (currentItem === errorObj) { return o.onError(currentItem.e); }
|
1891
|
+
|
1892
|
+
if (currentItem.done) {
|
1893
|
+
return lastException !== null ? o.onError(lastException) : o.onCompleted();
|
1894
|
+
}
|
1895
|
+
|
1896
|
+
// Check if promise
|
1897
|
+
var currentValue = currentItem.value;
|
1898
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1899
|
+
|
1900
|
+
var d = new SingleAssignmentDisposable();
|
1901
|
+
subscription.setDisposable(d);
|
1902
|
+
d.setDisposable(currentValue.subscribe(
|
1903
|
+
function(x) { o.onNext(x); },
|
1904
|
+
self,
|
1905
|
+
function() { o.onCompleted(); }));
|
1906
|
+
});
|
1907
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
1908
|
+
isDisposed = true;
|
1909
|
+
}));
|
1910
|
+
};
|
1911
|
+
|
1912
|
+
return CatchErrorObservable;
|
1913
|
+
}(ObservableBase));
|
1914
|
+
|
1915
|
+
Enumerable.prototype.catchError = function () {
|
1916
|
+
return new CatchErrorObservable(this);
|
1917
|
+
};
|
1918
|
+
|
1919
|
+
Enumerable.prototype.catchErrorWhen = function (notificationHandler) {
|
1920
|
+
var sources = this;
|
1921
|
+
return new AnonymousObservable(function (o) {
|
1922
|
+
var exceptions = new Subject(),
|
1923
|
+
notifier = new Subject(),
|
1924
|
+
handled = notificationHandler(exceptions),
|
1925
|
+
notificationDisposable = handled.subscribe(notifier);
|
1926
|
+
|
1927
|
+
var e = sources[$iterator$]();
|
1928
|
+
|
1929
|
+
var isDisposed,
|
1930
|
+
lastException,
|
1931
|
+
subscription = new SerialDisposable();
|
1932
|
+
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
|
1933
|
+
if (isDisposed) { return; }
|
1934
|
+
var currentItem = tryCatch(e.next).call(e);
|
1935
|
+
if (currentItem === errorObj) { return o.onError(currentItem.e); }
|
1936
|
+
|
1937
|
+
if (currentItem.done) {
|
1938
|
+
if (lastException) {
|
1939
|
+
o.onError(lastException);
|
1940
|
+
} else {
|
1941
|
+
o.onCompleted();
|
1942
|
+
}
|
1943
|
+
return;
|
1944
|
+
}
|
1945
|
+
|
1946
|
+
// Check if promise
|
1947
|
+
var currentValue = currentItem.value;
|
1948
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
1949
|
+
|
1950
|
+
var outer = new SingleAssignmentDisposable();
|
1951
|
+
var inner = new SingleAssignmentDisposable();
|
1952
|
+
subscription.setDisposable(new CompositeDisposable(inner, outer));
|
1953
|
+
outer.setDisposable(currentValue.subscribe(
|
1954
|
+
function(x) { o.onNext(x); },
|
1955
|
+
function (exn) {
|
1956
|
+
inner.setDisposable(notifier.subscribe(self, function(ex) {
|
1957
|
+
o.onError(ex);
|
1958
|
+
}, function() {
|
1959
|
+
o.onCompleted();
|
1960
|
+
}));
|
1961
|
+
|
1962
|
+
exceptions.onNext(exn);
|
1963
|
+
},
|
1964
|
+
function() { o.onCompleted(); }));
|
1965
|
+
});
|
1966
|
+
|
1967
|
+
return new CompositeDisposable(notificationDisposable, subscription, cancelable, disposableCreate(function () {
|
1968
|
+
isDisposed = true;
|
1969
|
+
}));
|
1970
|
+
});
|
2037
1971
|
};
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
1972
|
+
|
1973
|
+
var RepeatEnumerable = (function (__super__) {
|
1974
|
+
inherits(RepeatEnumerable, __super__);
|
1975
|
+
|
1976
|
+
function RepeatEnumerable(v, c) {
|
1977
|
+
this.v = v;
|
1978
|
+
this.c = c == null ? -1 : c;
|
2043
1979
|
}
|
1980
|
+
RepeatEnumerable.prototype[$iterator$] = function () {
|
1981
|
+
return new RepeatEnumerator(this);
|
1982
|
+
};
|
1983
|
+
|
1984
|
+
function RepeatEnumerator(p) {
|
1985
|
+
this.v = p.v;
|
1986
|
+
this.l = p.c;
|
1987
|
+
}
|
1988
|
+
RepeatEnumerator.prototype.next = function () {
|
1989
|
+
if (this.l === 0) { return doneEnumerator; }
|
1990
|
+
if (this.l > 0) { this.l--; }
|
1991
|
+
return { done: false, value: this.v };
|
1992
|
+
};
|
1993
|
+
|
1994
|
+
return RepeatEnumerable;
|
1995
|
+
}(Enumerable));
|
1996
|
+
|
1997
|
+
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
|
1998
|
+
return new RepeatEnumerable(value, repeatCount);
|
2044
1999
|
};
|
2045
|
-
|
2046
|
-
|
2047
|
-
|
2048
|
-
|
2049
|
-
this.
|
2050
|
-
|
2000
|
+
|
2001
|
+
var OfEnumerable = (function(__super__) {
|
2002
|
+
inherits(OfEnumerable, __super__);
|
2003
|
+
function OfEnumerable(s, fn, thisArg) {
|
2004
|
+
this.s = s;
|
2005
|
+
this.fn = fn ? bindCallback(fn, thisArg, 3) : null;
|
2051
2006
|
}
|
2007
|
+
OfEnumerable.prototype[$iterator$] = function () {
|
2008
|
+
return new OfEnumerator(this);
|
2009
|
+
};
|
2010
|
+
|
2011
|
+
function OfEnumerator(p) {
|
2012
|
+
this.i = -1;
|
2013
|
+
this.s = p.s;
|
2014
|
+
this.l = this.s.length;
|
2015
|
+
this.fn = p.fn;
|
2016
|
+
}
|
2017
|
+
OfEnumerator.prototype.next = function () {
|
2018
|
+
return ++this.i < this.l ?
|
2019
|
+
{ done: false, value: !this.fn ? this.s[this.i] : this.fn(this.s[this.i], this.i, this.s) } :
|
2020
|
+
doneEnumerator;
|
2021
|
+
};
|
2022
|
+
|
2023
|
+
return OfEnumerable;
|
2024
|
+
}(Enumerable));
|
2052
2025
|
|
2053
|
-
|
2026
|
+
var enumerableOf = Enumerable.of = function (source, selector, thisArg) {
|
2027
|
+
return new OfEnumerable(source, selector, thisArg);
|
2054
2028
|
};
|
2055
2029
|
|
2030
|
+
var ToArrayObservable = (function(__super__) {
|
2031
|
+
inherits(ToArrayObservable, __super__);
|
2032
|
+
function ToArrayObservable(source) {
|
2033
|
+
this.source = source;
|
2034
|
+
__super__.call(this);
|
2035
|
+
}
|
2036
|
+
|
2037
|
+
ToArrayObservable.prototype.subscribeCore = function(o) {
|
2038
|
+
return this.source.subscribe(new InnerObserver(o));
|
2039
|
+
};
|
2040
|
+
|
2041
|
+
function InnerObserver(o) {
|
2042
|
+
this.o = o;
|
2043
|
+
this.a = [];
|
2044
|
+
this.isStopped = false;
|
2045
|
+
}
|
2046
|
+
InnerObserver.prototype.onNext = function (x) { if(!this.isStopped) { this.a.push(x); } };
|
2047
|
+
InnerObserver.prototype.onError = function (e) {
|
2048
|
+
if (!this.isStopped) {
|
2049
|
+
this.isStopped = true;
|
2050
|
+
this.o.onError(e);
|
2051
|
+
}
|
2052
|
+
};
|
2053
|
+
InnerObserver.prototype.onCompleted = function () {
|
2054
|
+
if (!this.isStopped) {
|
2055
|
+
this.isStopped = true;
|
2056
|
+
this.o.onNext(this.a);
|
2057
|
+
this.o.onCompleted();
|
2058
|
+
}
|
2059
|
+
};
|
2060
|
+
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
|
2061
|
+
InnerObserver.prototype.fail = function (e) {
|
2062
|
+
if (!this.isStopped) {
|
2063
|
+
this.isStopped = true;
|
2064
|
+
this.o.onError(e);
|
2065
|
+
return true;
|
2066
|
+
}
|
2067
|
+
|
2068
|
+
return false;
|
2069
|
+
};
|
2070
|
+
|
2071
|
+
return ToArrayObservable;
|
2072
|
+
}(ObservableBase));
|
2073
|
+
|
2056
2074
|
/**
|
2057
2075
|
* Creates an array from an observable sequence.
|
2058
2076
|
* @returns {Observable} An observable sequence containing a single element with a list containing all the elements of the source sequence.
|
@@ -2070,7 +2088,7 @@
|
|
2070
2088
|
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
|
2071
2089
|
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
|
2072
2090
|
*/
|
2073
|
-
Observable.create =
|
2091
|
+
Observable.create = function (subscribe, parent) {
|
2074
2092
|
return new AnonymousObservable(subscribe, parent);
|
2075
2093
|
};
|
2076
2094
|
|
@@ -2103,26 +2121,29 @@
|
|
2103
2121
|
}
|
2104
2122
|
|
2105
2123
|
EmptyObservable.prototype.subscribeCore = function (observer) {
|
2106
|
-
var sink = new EmptySink(observer, this);
|
2124
|
+
var sink = new EmptySink(observer, this.scheduler);
|
2107
2125
|
return sink.run();
|
2108
2126
|
};
|
2109
2127
|
|
2110
|
-
function EmptySink(observer,
|
2128
|
+
function EmptySink(observer, scheduler) {
|
2111
2129
|
this.observer = observer;
|
2112
|
-
this.
|
2130
|
+
this.scheduler = scheduler;
|
2113
2131
|
}
|
2114
2132
|
|
2115
2133
|
function scheduleItem(s, state) {
|
2116
2134
|
state.onCompleted();
|
2135
|
+
return disposableEmpty;
|
2117
2136
|
}
|
2118
2137
|
|
2119
2138
|
EmptySink.prototype.run = function () {
|
2120
|
-
return this.
|
2139
|
+
return this.scheduler.scheduleWithState(this.observer, scheduleItem);
|
2121
2140
|
};
|
2122
2141
|
|
2123
2142
|
return EmptyObservable;
|
2124
2143
|
}(ObservableBase));
|
2125
2144
|
|
2145
|
+
var EMPTY_OBSERVABLE = new EmptyObservable(immediateScheduler);
|
2146
|
+
|
2126
2147
|
/**
|
2127
2148
|
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
|
2128
2149
|
*
|
@@ -2134,7 +2155,7 @@
|
|
2134
2155
|
*/
|
2135
2156
|
var observableEmpty = Observable.empty = function (scheduler) {
|
2136
2157
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
2137
|
-
return new EmptyObservable(scheduler);
|
2158
|
+
return scheduler === immediateScheduler ? EMPTY_OBSERVABLE : new EmptyObservable(scheduler);
|
2138
2159
|
};
|
2139
2160
|
|
2140
2161
|
var FromObservable = (function(__super__) {
|
@@ -2146,8 +2167,8 @@
|
|
2146
2167
|
__super__.call(this);
|
2147
2168
|
}
|
2148
2169
|
|
2149
|
-
FromObservable.prototype.subscribeCore = function (
|
2150
|
-
var sink = new FromSink(
|
2170
|
+
FromObservable.prototype.subscribeCore = function (o) {
|
2171
|
+
var sink = new FromSink(o, this);
|
2151
2172
|
return sink.run();
|
2152
2173
|
};
|
2153
2174
|
|
@@ -2155,38 +2176,30 @@
|
|
2155
2176
|
}(ObservableBase));
|
2156
2177
|
|
2157
2178
|
var FromSink = (function () {
|
2158
|
-
function FromSink(
|
2159
|
-
this.
|
2179
|
+
function FromSink(o, parent) {
|
2180
|
+
this.o = o;
|
2160
2181
|
this.parent = parent;
|
2161
2182
|
}
|
2162
2183
|
|
2163
2184
|
FromSink.prototype.run = function () {
|
2164
2185
|
var list = Object(this.parent.iterable),
|
2165
2186
|
it = getIterable(list),
|
2166
|
-
|
2187
|
+
o = this.o,
|
2167
2188
|
mapper = this.parent.mapper;
|
2168
2189
|
|
2169
2190
|
function loopRecursive(i, recurse) {
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
return observer.onError(e);
|
2174
|
-
}
|
2175
|
-
if (next.done) {
|
2176
|
-
return observer.onCompleted();
|
2177
|
-
}
|
2191
|
+
var next = tryCatch(it.next).call(it);
|
2192
|
+
if (next === errorObj) { return o.onError(next.e); }
|
2193
|
+
if (next.done) { return o.onCompleted(); }
|
2178
2194
|
|
2179
2195
|
var result = next.value;
|
2180
2196
|
|
2181
|
-
if (mapper) {
|
2182
|
-
|
2183
|
-
|
2184
|
-
} catch (e) {
|
2185
|
-
return observer.onError(e);
|
2186
|
-
}
|
2197
|
+
if (isFunction(mapper)) {
|
2198
|
+
result = tryCatch(mapper)(result, i);
|
2199
|
+
if (result === errorObj) { return o.onError(result.e); }
|
2187
2200
|
}
|
2188
2201
|
|
2189
|
-
|
2202
|
+
o.onNext(result);
|
2190
2203
|
recurse(i + 1);
|
2191
2204
|
}
|
2192
2205
|
|
@@ -2198,7 +2211,7 @@
|
|
2198
2211
|
|
2199
2212
|
var maxSafeInteger = Math.pow(2, 53) - 1;
|
2200
2213
|
|
2201
|
-
function StringIterable(
|
2214
|
+
function StringIterable(s) {
|
2202
2215
|
this._s = s;
|
2203
2216
|
}
|
2204
2217
|
|
@@ -2206,7 +2219,7 @@
|
|
2206
2219
|
return new StringIterator(this._s);
|
2207
2220
|
};
|
2208
2221
|
|
2209
|
-
function StringIterator(
|
2222
|
+
function StringIterator(s) {
|
2210
2223
|
this._s = s;
|
2211
2224
|
this._l = s.length;
|
2212
2225
|
this._i = 0;
|
@@ -2361,12 +2374,14 @@
|
|
2361
2374
|
return NeverObservable;
|
2362
2375
|
}(ObservableBase));
|
2363
2376
|
|
2377
|
+
var NEVER_OBSERVABLE = new NeverObservable();
|
2378
|
+
|
2364
2379
|
/**
|
2365
2380
|
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
|
2366
2381
|
* @returns {Observable} An observable sequence whose observers will never get called.
|
2367
2382
|
*/
|
2368
2383
|
var observableNever = Observable.never = function () {
|
2369
|
-
return
|
2384
|
+
return NEVER_OBSERVABLE;
|
2370
2385
|
};
|
2371
2386
|
|
2372
2387
|
function observableOf (scheduler, array) {
|
@@ -2447,7 +2462,7 @@
|
|
2447
2462
|
inherits(RangeObservable, __super__);
|
2448
2463
|
function RangeObservable(start, count, scheduler) {
|
2449
2464
|
this.start = start;
|
2450
|
-
this.
|
2465
|
+
this.rangeCount = count;
|
2451
2466
|
this.scheduler = scheduler;
|
2452
2467
|
__super__.call(this);
|
2453
2468
|
}
|
@@ -2467,7 +2482,7 @@
|
|
2467
2482
|
}
|
2468
2483
|
|
2469
2484
|
RangeSink.prototype.run = function () {
|
2470
|
-
var start = this.parent.start, count = this.parent.
|
2485
|
+
var start = this.parent.start, count = this.parent.rangeCount, observer = this.observer;
|
2471
2486
|
function loopRecursive(i, recurse) {
|
2472
2487
|
if (i < count) {
|
2473
2488
|
observer.onNext(start + i);
|
@@ -2552,23 +2567,28 @@
|
|
2552
2567
|
}
|
2553
2568
|
|
2554
2569
|
JustObservable.prototype.subscribeCore = function (observer) {
|
2555
|
-
var sink = new JustSink(observer, this);
|
2570
|
+
var sink = new JustSink(observer, this.value, this.scheduler);
|
2556
2571
|
return sink.run();
|
2557
2572
|
};
|
2558
2573
|
|
2559
|
-
function JustSink(observer,
|
2574
|
+
function JustSink(observer, value, scheduler) {
|
2560
2575
|
this.observer = observer;
|
2561
|
-
this.
|
2576
|
+
this.value = value;
|
2577
|
+
this.scheduler = scheduler;
|
2562
2578
|
}
|
2563
2579
|
|
2564
2580
|
function scheduleItem(s, state) {
|
2565
2581
|
var value = state[0], observer = state[1];
|
2566
2582
|
observer.onNext(value);
|
2567
2583
|
observer.onCompleted();
|
2584
|
+
return disposableEmpty;
|
2568
2585
|
}
|
2569
2586
|
|
2570
2587
|
JustSink.prototype.run = function () {
|
2571
|
-
|
2588
|
+
var state = [this.value, this.observer];
|
2589
|
+
return this.scheduler === immediateScheduler ?
|
2590
|
+
scheduleItem(null, state) :
|
2591
|
+
this.scheduler.scheduleWithState(state, scheduleItem);
|
2572
2592
|
};
|
2573
2593
|
|
2574
2594
|
return JustObservable;
|
@@ -2581,7 +2601,7 @@
|
|
2581
2601
|
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
|
2582
2602
|
* @returns {Observable} An observable sequence containing the single specified element.
|
2583
2603
|
*/
|
2584
|
-
var observableReturn = Observable['return'] = Observable.just =
|
2604
|
+
var observableReturn = Observable['return'] = Observable.just = function (value, scheduler) {
|
2585
2605
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
2586
2606
|
return new JustObservable(value, scheduler);
|
2587
2607
|
};
|
@@ -2594,23 +2614,23 @@
|
|
2594
2614
|
__super__.call(this);
|
2595
2615
|
}
|
2596
2616
|
|
2597
|
-
ThrowObservable.prototype.subscribeCore = function (
|
2598
|
-
var sink = new ThrowSink(
|
2617
|
+
ThrowObservable.prototype.subscribeCore = function (o) {
|
2618
|
+
var sink = new ThrowSink(o, this);
|
2599
2619
|
return sink.run();
|
2600
2620
|
};
|
2601
2621
|
|
2602
|
-
function ThrowSink(
|
2603
|
-
this.
|
2604
|
-
this.
|
2622
|
+
function ThrowSink(o, p) {
|
2623
|
+
this.o = o;
|
2624
|
+
this.p = p;
|
2605
2625
|
}
|
2606
2626
|
|
2607
2627
|
function scheduleItem(s, state) {
|
2608
|
-
var
|
2609
|
-
|
2628
|
+
var e = state[0], o = state[1];
|
2629
|
+
o.onError(e);
|
2610
2630
|
}
|
2611
2631
|
|
2612
2632
|
ThrowSink.prototype.run = function () {
|
2613
|
-
return this.
|
2633
|
+
return this.p.scheduler.scheduleWithState([this.p.error, this.o], scheduleItem);
|
2614
2634
|
};
|
2615
2635
|
|
2616
2636
|
return ThrowObservable;
|
@@ -2623,44 +2643,51 @@
|
|
2623
2643
|
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
|
2624
2644
|
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
|
2625
2645
|
*/
|
2626
|
-
var observableThrow = Observable['throw'] =
|
2646
|
+
var observableThrow = Observable['throw'] = function (error, scheduler) {
|
2627
2647
|
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
2628
2648
|
return new ThrowObservable(error, scheduler);
|
2629
2649
|
};
|
2630
2650
|
|
2651
|
+
var CatchObserver = (function(__super__) {
|
2652
|
+
inherits(CatchObserver, __super__);
|
2653
|
+
function CatchObserver(o, s, fn) {
|
2654
|
+
this._o = o;
|
2655
|
+
this._s = s;
|
2656
|
+
this._fn = fn;
|
2657
|
+
__super__.call(this);
|
2658
|
+
}
|
2659
|
+
|
2660
|
+
CatchObserver.prototype.next = function (x) { this._o.onNext(x); };
|
2661
|
+
CatchObserver.prototype.completed = function () { return this._o.onCompleted(); };
|
2662
|
+
CatchObserver.prototype.error = function (e) {
|
2663
|
+
var result = tryCatch(this._fn)(e);
|
2664
|
+
if (result === errorObj) { return this._o.onError(result.e); }
|
2665
|
+
isPromise(result) && (result = observableFromPromise(result));
|
2666
|
+
|
2667
|
+
var d = new SingleAssignmentDisposable();
|
2668
|
+
this._s.setDisposable(d);
|
2669
|
+
d.setDisposable(result.subscribe(this._o));
|
2670
|
+
};
|
2671
|
+
|
2672
|
+
return CatchObserver;
|
2673
|
+
}(AbstractObserver));
|
2674
|
+
|
2631
2675
|
function observableCatchHandler(source, handler) {
|
2632
2676
|
return new AnonymousObservable(function (o) {
|
2633
2677
|
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
|
2634
2678
|
subscription.setDisposable(d1);
|
2635
|
-
d1.setDisposable(source.subscribe(
|
2636
|
-
try {
|
2637
|
-
var result = handler(e);
|
2638
|
-
} catch (ex) {
|
2639
|
-
return o.onError(ex);
|
2640
|
-
}
|
2641
|
-
isPromise(result) && (result = observableFromPromise(result));
|
2642
|
-
|
2643
|
-
var d = new SingleAssignmentDisposable();
|
2644
|
-
subscription.setDisposable(d);
|
2645
|
-
d.setDisposable(result.subscribe(o));
|
2646
|
-
}, function (x) { o.onCompleted(x); }));
|
2647
|
-
|
2679
|
+
d1.setDisposable(source.subscribe(new CatchObserver(o, subscription, handler)));
|
2648
2680
|
return subscription;
|
2649
2681
|
}, source);
|
2650
2682
|
}
|
2651
2683
|
|
2652
2684
|
/**
|
2653
2685
|
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
|
2654
|
-
* @example
|
2655
|
-
* 1 - xs.catchException(ys)
|
2656
|
-
* 2 - xs.catchException(function (ex) { return ys(ex); })
|
2657
2686
|
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
|
2658
2687
|
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
|
2659
2688
|
*/
|
2660
|
-
observableProto['catch'] =
|
2661
|
-
return
|
2662
|
-
observableCatchHandler(this, handlerOrSecond) :
|
2663
|
-
observableCatch([this, handlerOrSecond]);
|
2689
|
+
observableProto['catch'] = function (handlerOrSecond) {
|
2690
|
+
return isFunction(handlerOrSecond) ? observableCatchHandler(this, handlerOrSecond) : observableCatch([this, handlerOrSecond]);
|
2664
2691
|
};
|
2665
2692
|
|
2666
2693
|
/**
|
@@ -2668,12 +2695,14 @@
|
|
2668
2695
|
* @param {Array | Arguments} args Arguments or an array to use as the next sequence if an error occurs.
|
2669
2696
|
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
|
2670
2697
|
*/
|
2671
|
-
var observableCatch = Observable
|
2672
|
-
var items
|
2698
|
+
var observableCatch = Observable['catch'] = function () {
|
2699
|
+
var items;
|
2673
2700
|
if (Array.isArray(arguments[0])) {
|
2674
2701
|
items = arguments[0];
|
2675
2702
|
} else {
|
2676
|
-
|
2703
|
+
var len = arguments.length;
|
2704
|
+
items = new Array(len);
|
2705
|
+
for(var i = 0; i < len; i++) { items[i] = arguments[i]; }
|
2677
2706
|
}
|
2678
2707
|
return enumerableOf(items).catchError();
|
2679
2708
|
};
|
@@ -2698,6 +2727,13 @@
|
|
2698
2727
|
return combineLatest.apply(this, args);
|
2699
2728
|
};
|
2700
2729
|
|
2730
|
+
function falseFactory() { return false; }
|
2731
|
+
function argumentsToArray() {
|
2732
|
+
var len = arguments.length, args = new Array(len);
|
2733
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
2734
|
+
return args;
|
2735
|
+
}
|
2736
|
+
|
2701
2737
|
/**
|
2702
2738
|
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
|
2703
2739
|
*
|
@@ -2709,12 +2745,11 @@
|
|
2709
2745
|
var combineLatest = Observable.combineLatest = function () {
|
2710
2746
|
var len = arguments.length, args = new Array(len);
|
2711
2747
|
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
2712
|
-
var resultSelector = args.pop();
|
2748
|
+
var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;
|
2713
2749
|
Array.isArray(args[0]) && (args = args[0]);
|
2714
2750
|
|
2715
2751
|
return new AnonymousObservable(function (o) {
|
2716
2752
|
var n = args.length,
|
2717
|
-
falseFactory = function () { return false; },
|
2718
2753
|
hasValue = arrayInitialize(n, falseFactory),
|
2719
2754
|
hasValueAll = false,
|
2720
2755
|
isDone = arrayInitialize(n, falseFactory),
|
@@ -2769,11 +2804,57 @@
|
|
2769
2804
|
return observableConcat.apply(null, args);
|
2770
2805
|
};
|
2771
2806
|
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
|
2776
|
-
|
2807
|
+
var ConcatObservable = (function(__super__) {
|
2808
|
+
inherits(ConcatObservable, __super__);
|
2809
|
+
function ConcatObservable(sources) {
|
2810
|
+
this.sources = sources;
|
2811
|
+
__super__.call(this);
|
2812
|
+
}
|
2813
|
+
|
2814
|
+
ConcatObservable.prototype.subscribeCore = function(o) {
|
2815
|
+
var sink = new ConcatSink(this.sources, o);
|
2816
|
+
return sink.run();
|
2817
|
+
};
|
2818
|
+
|
2819
|
+
function ConcatSink(sources, o) {
|
2820
|
+
this.sources = sources;
|
2821
|
+
this.o = o;
|
2822
|
+
}
|
2823
|
+
ConcatSink.prototype.run = function () {
|
2824
|
+
var isDisposed, subscription = new SerialDisposable(), sources = this.sources, length = sources.length, o = this.o;
|
2825
|
+
var cancelable = immediateScheduler.scheduleRecursiveWithState(0, function (i, self) {
|
2826
|
+
if (isDisposed) { return; }
|
2827
|
+
if (i === length) {
|
2828
|
+
return o.onCompleted();
|
2829
|
+
}
|
2830
|
+
|
2831
|
+
// Check if promise
|
2832
|
+
var currentValue = sources[i];
|
2833
|
+
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
|
2834
|
+
|
2835
|
+
var d = new SingleAssignmentDisposable();
|
2836
|
+
subscription.setDisposable(d);
|
2837
|
+
d.setDisposable(currentValue.subscribe(
|
2838
|
+
function (x) { o.onNext(x); },
|
2839
|
+
function (e) { o.onError(e); },
|
2840
|
+
function () { self(i + 1); }
|
2841
|
+
));
|
2842
|
+
});
|
2843
|
+
|
2844
|
+
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
|
2845
|
+
isDisposed = true;
|
2846
|
+
}));
|
2847
|
+
};
|
2848
|
+
|
2849
|
+
|
2850
|
+
return ConcatObservable;
|
2851
|
+
}(ObservableBase));
|
2852
|
+
|
2853
|
+
/**
|
2854
|
+
* Concatenates all the observable sequences.
|
2855
|
+
* @param {Array | Arguments} args Arguments or an array to concat to the observable sequence.
|
2856
|
+
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
|
2857
|
+
*/
|
2777
2858
|
var observableConcat = Observable.concat = function () {
|
2778
2859
|
var args;
|
2779
2860
|
if (Array.isArray(arguments[0])) {
|
@@ -2782,14 +2863,14 @@
|
|
2782
2863
|
args = new Array(arguments.length);
|
2783
2864
|
for(var i = 0, len = arguments.length; i < len; i++) { args[i] = arguments[i]; }
|
2784
2865
|
}
|
2785
|
-
return
|
2866
|
+
return new ConcatObservable(args);
|
2786
2867
|
};
|
2787
2868
|
|
2788
2869
|
/**
|
2789
2870
|
* Concatenates an observable sequence of observable sequences.
|
2790
2871
|
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
|
2791
2872
|
*/
|
2792
|
-
observableProto.concatAll =
|
2873
|
+
observableProto.concatAll = function () {
|
2793
2874
|
return this.merge(1);
|
2794
2875
|
};
|
2795
2876
|
|
@@ -3039,11 +3120,6 @@
|
|
3039
3120
|
return g;
|
3040
3121
|
};
|
3041
3122
|
|
3042
|
-
return MergeAllObservable;
|
3043
|
-
}(ObservableBase));
|
3044
|
-
|
3045
|
-
var MergeAllObserver = (function() {
|
3046
|
-
|
3047
3123
|
function MergeAllObserver(o, g) {
|
3048
3124
|
this.o = o;
|
3049
3125
|
this.g = g;
|
@@ -3057,7 +3133,7 @@
|
|
3057
3133
|
|
3058
3134
|
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
3059
3135
|
|
3060
|
-
sad.setDisposable(innerSource.subscribe(new InnerObserver(this,
|
3136
|
+
sad.setDisposable(innerSource.subscribe(new InnerObserver(this, sad)));
|
3061
3137
|
};
|
3062
3138
|
MergeAllObserver.prototype.onError = function (e) {
|
3063
3139
|
if(!this.isStopped) {
|
@@ -3083,9 +3159,8 @@
|
|
3083
3159
|
return false;
|
3084
3160
|
};
|
3085
3161
|
|
3086
|
-
function InnerObserver(parent,
|
3162
|
+
function InnerObserver(parent, sad) {
|
3087
3163
|
this.parent = parent;
|
3088
|
-
this.g = g;
|
3089
3164
|
this.sad = sad;
|
3090
3165
|
this.isStopped = false;
|
3091
3166
|
}
|
@@ -3115,15 +3190,14 @@
|
|
3115
3190
|
return false;
|
3116
3191
|
};
|
3117
3192
|
|
3118
|
-
return
|
3119
|
-
|
3120
|
-
}());
|
3193
|
+
return MergeAllObservable;
|
3194
|
+
}(ObservableBase));
|
3121
3195
|
|
3122
3196
|
/**
|
3123
3197
|
* Merges an observable sequence of observable sequences into an observable sequence.
|
3124
3198
|
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
|
3125
3199
|
*/
|
3126
|
-
observableProto.mergeAll =
|
3200
|
+
observableProto.mergeAll = function () {
|
3127
3201
|
return new MergeAllObservable(this);
|
3128
3202
|
};
|
3129
3203
|
|
@@ -3157,87 +3231,171 @@
|
|
3157
3231
|
}, source);
|
3158
3232
|
};
|
3159
3233
|
|
3234
|
+
var SwitchObservable = (function(__super__) {
|
3235
|
+
inherits(SwitchObservable, __super__);
|
3236
|
+
function SwitchObservable(source) {
|
3237
|
+
this.source = source;
|
3238
|
+
__super__.call(this);
|
3239
|
+
}
|
3240
|
+
|
3241
|
+
SwitchObservable.prototype.subscribeCore = function (o) {
|
3242
|
+
var inner = new SerialDisposable(), s = this.source.subscribe(new SwitchObserver(o, inner));
|
3243
|
+
return new CompositeDisposable(s, inner);
|
3244
|
+
};
|
3245
|
+
|
3246
|
+
function SwitchObserver(o, inner) {
|
3247
|
+
this.o = o;
|
3248
|
+
this.inner = inner;
|
3249
|
+
this.stopped = false;
|
3250
|
+
this.latest = 0;
|
3251
|
+
this.hasLatest = false;
|
3252
|
+
this.isStopped = false;
|
3253
|
+
}
|
3254
|
+
SwitchObserver.prototype.onNext = function (innerSource) {
|
3255
|
+
if (this.isStopped) { return; }
|
3256
|
+
var d = new SingleAssignmentDisposable(), id = ++this.latest;
|
3257
|
+
this.hasLatest = true;
|
3258
|
+
this.inner.setDisposable(d);
|
3259
|
+
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
3260
|
+
d.setDisposable(innerSource.subscribe(new InnerObserver(this, id)));
|
3261
|
+
};
|
3262
|
+
SwitchObserver.prototype.onError = function (e) {
|
3263
|
+
if (!this.isStopped) {
|
3264
|
+
this.isStopped = true;
|
3265
|
+
this.o.onError(e);
|
3266
|
+
}
|
3267
|
+
};
|
3268
|
+
SwitchObserver.prototype.onCompleted = function () {
|
3269
|
+
if (!this.isStopped) {
|
3270
|
+
this.isStopped = true;
|
3271
|
+
this.stopped = true;
|
3272
|
+
!this.hasLatest && this.o.onCompleted();
|
3273
|
+
}
|
3274
|
+
};
|
3275
|
+
SwitchObserver.prototype.dispose = function () { this.isStopped = true; };
|
3276
|
+
SwitchObserver.prototype.fail = function (e) {
|
3277
|
+
if(!this.isStopped) {
|
3278
|
+
this.isStopped = true;
|
3279
|
+
this.o.onError(e);
|
3280
|
+
return true;
|
3281
|
+
}
|
3282
|
+
return false;
|
3283
|
+
};
|
3284
|
+
|
3285
|
+
function InnerObserver(parent, id) {
|
3286
|
+
this.parent = parent;
|
3287
|
+
this.id = id;
|
3288
|
+
this.isStopped = false;
|
3289
|
+
}
|
3290
|
+
InnerObserver.prototype.onNext = function (x) {
|
3291
|
+
if (this.isStopped) { return; }
|
3292
|
+
this.parent.latest === this.id && this.parent.o.onNext(x);
|
3293
|
+
};
|
3294
|
+
InnerObserver.prototype.onError = function (e) {
|
3295
|
+
if (!this.isStopped) {
|
3296
|
+
this.isStopped = true;
|
3297
|
+
this.parent.latest === this.id && this.parent.o.onError(e);
|
3298
|
+
}
|
3299
|
+
};
|
3300
|
+
InnerObserver.prototype.onCompleted = function () {
|
3301
|
+
if (!this.isStopped) {
|
3302
|
+
this.isStopped = true;
|
3303
|
+
if (this.parent.latest === this.id) {
|
3304
|
+
this.parent.hasLatest = false;
|
3305
|
+
this.parent.isStopped && this.parent.o.onCompleted();
|
3306
|
+
}
|
3307
|
+
}
|
3308
|
+
};
|
3309
|
+
InnerObserver.prototype.dispose = function () { this.isStopped = true; }
|
3310
|
+
InnerObserver.prototype.fail = function (e) {
|
3311
|
+
if(!this.isStopped) {
|
3312
|
+
this.isStopped = true;
|
3313
|
+
this.parent.o.onError(e);
|
3314
|
+
return true;
|
3315
|
+
}
|
3316
|
+
return false;
|
3317
|
+
};
|
3318
|
+
|
3319
|
+
return SwitchObservable;
|
3320
|
+
}(ObservableBase));
|
3321
|
+
|
3160
3322
|
/**
|
3161
|
-
|
3162
|
-
|
3163
|
-
|
3323
|
+
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
|
3324
|
+
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
3325
|
+
*/
|
3164
3326
|
observableProto['switch'] = observableProto.switchLatest = function () {
|
3165
|
-
|
3166
|
-
return new AnonymousObservable(function (observer) {
|
3167
|
-
var hasLatest = false,
|
3168
|
-
innerSubscription = new SerialDisposable(),
|
3169
|
-
isStopped = false,
|
3170
|
-
latest = 0,
|
3171
|
-
subscription = sources.subscribe(
|
3172
|
-
function (innerSource) {
|
3173
|
-
var d = new SingleAssignmentDisposable(), id = ++latest;
|
3174
|
-
hasLatest = true;
|
3175
|
-
innerSubscription.setDisposable(d);
|
3176
|
-
|
3177
|
-
// Check if Promise or Observable
|
3178
|
-
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
3179
|
-
|
3180
|
-
d.setDisposable(innerSource.subscribe(
|
3181
|
-
function (x) { latest === id && observer.onNext(x); },
|
3182
|
-
function (e) { latest === id && observer.onError(e); },
|
3183
|
-
function () {
|
3184
|
-
if (latest === id) {
|
3185
|
-
hasLatest = false;
|
3186
|
-
isStopped && observer.onCompleted();
|
3187
|
-
}
|
3188
|
-
}));
|
3189
|
-
},
|
3190
|
-
function (e) { observer.onError(e); },
|
3191
|
-
function () {
|
3192
|
-
isStopped = true;
|
3193
|
-
!hasLatest && observer.onCompleted();
|
3194
|
-
});
|
3195
|
-
return new CompositeDisposable(subscription, innerSubscription);
|
3196
|
-
}, sources);
|
3327
|
+
return new SwitchObservable(this);
|
3197
3328
|
};
|
3198
3329
|
|
3330
|
+
var TakeUntilObservable = (function(__super__) {
|
3331
|
+
inherits(TakeUntilObservable, __super__);
|
3332
|
+
|
3333
|
+
function TakeUntilObservable(source, other) {
|
3334
|
+
this.source = source;
|
3335
|
+
this.other = isPromise(other) ? observableFromPromise(other) : other;
|
3336
|
+
__super__.call(this);
|
3337
|
+
}
|
3338
|
+
|
3339
|
+
TakeUntilObservable.prototype.subscribeCore = function(o) {
|
3340
|
+
return new CompositeDisposable(
|
3341
|
+
this.source.subscribe(o),
|
3342
|
+
this.other.subscribe(new InnerObserver(o))
|
3343
|
+
);
|
3344
|
+
};
|
3345
|
+
|
3346
|
+
function InnerObserver(o) {
|
3347
|
+
this.o = o;
|
3348
|
+
this.isStopped = false;
|
3349
|
+
}
|
3350
|
+
InnerObserver.prototype.onNext = function (x) {
|
3351
|
+
if (this.isStopped) { return; }
|
3352
|
+
this.o.onCompleted();
|
3353
|
+
};
|
3354
|
+
InnerObserver.prototype.onError = function (err) {
|
3355
|
+
if (!this.isStopped) {
|
3356
|
+
this.isStopped = true;
|
3357
|
+
this.o.onError(err);
|
3358
|
+
}
|
3359
|
+
};
|
3360
|
+
InnerObserver.prototype.onCompleted = function () {
|
3361
|
+
!this.isStopped && (this.isStopped = true);
|
3362
|
+
};
|
3363
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
3364
|
+
InnerObserver.prototype.fail = function (e) {
|
3365
|
+
if (!this.isStopped) {
|
3366
|
+
this.isStopped = true;
|
3367
|
+
this.o.onError(e);
|
3368
|
+
return true;
|
3369
|
+
}
|
3370
|
+
return false;
|
3371
|
+
};
|
3372
|
+
|
3373
|
+
return TakeUntilObservable;
|
3374
|
+
}(ObservableBase));
|
3375
|
+
|
3199
3376
|
/**
|
3200
3377
|
* Returns the values from the source observable sequence until the other observable sequence produces a value.
|
3201
3378
|
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
|
3202
3379
|
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
|
3203
3380
|
*/
|
3204
3381
|
observableProto.takeUntil = function (other) {
|
3205
|
-
|
3206
|
-
return new AnonymousObservable(function (o) {
|
3207
|
-
isPromise(other) && (other = observableFromPromise(other));
|
3208
|
-
return new CompositeDisposable(
|
3209
|
-
source.subscribe(o),
|
3210
|
-
other.subscribe(function () { o.onCompleted(); }, function (e) { o.onError(e); }, noop)
|
3211
|
-
);
|
3212
|
-
}, source);
|
3382
|
+
return new TakeUntilObservable(this, other);
|
3213
3383
|
};
|
3214
3384
|
|
3385
|
+
function falseFactory() { return false; }
|
3386
|
+
|
3215
3387
|
/**
|
3216
3388
|
* Merges the specified observable sequences into one observable sequence by using the selector function only when the (first) source observable sequence produces an element.
|
3217
|
-
*
|
3218
|
-
* @example
|
3219
|
-
* 1 - obs = obs1.withLatestFrom(obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
|
3220
|
-
* 2 - obs = obs1.withLatestFrom([obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
|
3221
3389
|
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
3222
3390
|
*/
|
3223
3391
|
observableProto.withLatestFrom = function () {
|
3224
3392
|
var len = arguments.length, args = new Array(len)
|
3225
3393
|
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
3226
3394
|
var resultSelector = args.pop(), source = this;
|
3227
|
-
|
3228
|
-
if (typeof source === 'undefined') {
|
3229
|
-
throw new Error('Source observable not found for withLatestFrom().');
|
3230
|
-
}
|
3231
|
-
if (typeof resultSelector !== 'function') {
|
3232
|
-
throw new Error('withLatestFrom() expects a resultSelector function.');
|
3233
|
-
}
|
3234
|
-
if (Array.isArray(args[0])) {
|
3235
|
-
args = args[0];
|
3236
|
-
}
|
3395
|
+
Array.isArray(args[0]) && (args = args[0]);
|
3237
3396
|
|
3238
3397
|
return new AnonymousObservable(function (observer) {
|
3239
|
-
var
|
3240
|
-
n = args.length,
|
3398
|
+
var n = args.length,
|
3241
3399
|
hasValue = arrayInitialize(n, falseFactory),
|
3242
3400
|
hasValueAll = false,
|
3243
3401
|
values = new Array(n);
|
@@ -3251,24 +3409,19 @@
|
|
3251
3409
|
values[i] = x;
|
3252
3410
|
hasValue[i] = true;
|
3253
3411
|
hasValueAll = hasValue.every(identity);
|
3254
|
-
},
|
3412
|
+
}, function (e) { observer.onError(e); }, noop));
|
3255
3413
|
subscriptions[i] = sad;
|
3256
3414
|
}(idx));
|
3257
3415
|
}
|
3258
3416
|
|
3259
3417
|
var sad = new SingleAssignmentDisposable();
|
3260
3418
|
sad.setDisposable(source.subscribe(function (x) {
|
3261
|
-
var res;
|
3262
3419
|
var allValues = [x].concat(values);
|
3263
|
-
if (!hasValueAll) return;
|
3264
|
-
|
3265
|
-
|
3266
|
-
} catch (ex) {
|
3267
|
-
observer.onError(ex);
|
3268
|
-
return;
|
3269
|
-
}
|
3420
|
+
if (!hasValueAll) { return; }
|
3421
|
+
var res = tryCatch(resultSelector).apply(null, allValues);
|
3422
|
+
if (res === errorObj) { return observer.onError(res.e); }
|
3270
3423
|
observer.onNext(res);
|
3271
|
-
}, observer.onError
|
3424
|
+
}, function (e) { observer.onError(e); }, function () {
|
3272
3425
|
observer.onCompleted();
|
3273
3426
|
}));
|
3274
3427
|
subscriptions[n] = sad;
|
@@ -3277,83 +3430,54 @@
|
|
3277
3430
|
}, this);
|
3278
3431
|
};
|
3279
3432
|
|
3280
|
-
function zipArray(second, resultSelector) {
|
3281
|
-
var first = this;
|
3282
|
-
return new AnonymousObservable(function (observer) {
|
3283
|
-
var index = 0, len = second.length;
|
3284
|
-
return first.subscribe(function (left) {
|
3285
|
-
if (index < len) {
|
3286
|
-
var right = second[index++], result;
|
3287
|
-
try {
|
3288
|
-
result = resultSelector(left, right);
|
3289
|
-
} catch (e) {
|
3290
|
-
return observer.onError(e);
|
3291
|
-
}
|
3292
|
-
observer.onNext(result);
|
3293
|
-
} else {
|
3294
|
-
observer.onCompleted();
|
3295
|
-
}
|
3296
|
-
}, function (e) { observer.onError(e); }, function () { observer.onCompleted(); });
|
3297
|
-
}, first);
|
3298
|
-
}
|
3299
|
-
|
3300
3433
|
function falseFactory() { return false; }
|
3301
3434
|
function emptyArrayFactory() { return []; }
|
3435
|
+
function argumentsToArray() {
|
3436
|
+
var len = arguments.length, args = new Array(len);
|
3437
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
3438
|
+
return args;
|
3439
|
+
}
|
3302
3440
|
|
3303
3441
|
/**
|
3304
3442
|
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
|
3305
3443
|
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.
|
3306
|
-
*
|
3307
|
-
* @example
|
3308
|
-
* 1 - res = obs1.zip(obs2, fn);
|
3309
|
-
* 1 - res = x1.zip([1,2,3], fn);
|
3310
3444
|
* @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.
|
3311
3445
|
*/
|
3312
3446
|
observableProto.zip = function () {
|
3313
|
-
if (
|
3447
|
+
if (arguments.length === 0) { throw new Error('invalid arguments'); }
|
3448
|
+
|
3314
3449
|
var len = arguments.length, args = new Array(len);
|
3315
3450
|
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
3451
|
+
var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;
|
3452
|
+
Array.isArray(args[0]) && (args = args[0]);
|
3316
3453
|
|
3317
|
-
var parent = this
|
3454
|
+
var parent = this;
|
3318
3455
|
args.unshift(parent);
|
3319
|
-
return new AnonymousObservable(function (
|
3456
|
+
return new AnonymousObservable(function (o) {
|
3320
3457
|
var n = args.length,
|
3321
3458
|
queues = arrayInitialize(n, emptyArrayFactory),
|
3322
3459
|
isDone = arrayInitialize(n, falseFactory);
|
3323
3460
|
|
3324
|
-
function next(i) {
|
3325
|
-
var res, queuedValues;
|
3326
|
-
if (queues.every(function (x) { return x.length > 0; })) {
|
3327
|
-
try {
|
3328
|
-
queuedValues = queues.map(function (x) { return x.shift(); });
|
3329
|
-
res = resultSelector.apply(parent, queuedValues);
|
3330
|
-
} catch (ex) {
|
3331
|
-
observer.onError(ex);
|
3332
|
-
return;
|
3333
|
-
}
|
3334
|
-
observer.onNext(res);
|
3335
|
-
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
3336
|
-
observer.onCompleted();
|
3337
|
-
}
|
3338
|
-
};
|
3339
|
-
|
3340
|
-
function done(i) {
|
3341
|
-
isDone[i] = true;
|
3342
|
-
if (isDone.every(function (x) { return x; })) {
|
3343
|
-
observer.onCompleted();
|
3344
|
-
}
|
3345
|
-
}
|
3346
|
-
|
3347
3461
|
var subscriptions = new Array(n);
|
3348
3462
|
for (var idx = 0; idx < n; idx++) {
|
3349
3463
|
(function (i) {
|
3350
3464
|
var source = args[i], sad = new SingleAssignmentDisposable();
|
3465
|
+
|
3351
3466
|
isPromise(source) && (source = observableFromPromise(source));
|
3467
|
+
|
3352
3468
|
sad.setDisposable(source.subscribe(function (x) {
|
3353
3469
|
queues[i].push(x);
|
3354
|
-
|
3355
|
-
|
3356
|
-
|
3470
|
+
if (queues.every(function (x) { return x.length > 0; })) {
|
3471
|
+
var queuedValues = queues.map(function (x) { return x.shift(); }),
|
3472
|
+
res = tryCatch(resultSelector).apply(parent, queuedValues);
|
3473
|
+
if (res === errorObj) { return o.onError(res.e); }
|
3474
|
+
o.onNext(res);
|
3475
|
+
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
3476
|
+
o.onCompleted();
|
3477
|
+
}
|
3478
|
+
}, function (e) { o.onError(e); }, function () {
|
3479
|
+
isDone[i] = true;
|
3480
|
+
isDone.every(identity) && o.onCompleted();
|
3357
3481
|
}));
|
3358
3482
|
subscriptions[i] = sad;
|
3359
3483
|
})(idx);
|
@@ -3376,67 +3500,72 @@
|
|
3376
3500
|
return first.zip.apply(first, args);
|
3377
3501
|
};
|
3378
3502
|
|
3379
|
-
|
3380
|
-
|
3381
|
-
|
3382
|
-
|
3383
|
-
|
3384
|
-
|
3385
|
-
|
3386
|
-
|
3387
|
-
|
3388
|
-
|
3389
|
-
|
3390
|
-
|
3391
|
-
|
3503
|
+
function falseFactory() { return false; }
|
3504
|
+
function emptyArrayFactory() { return []; }
|
3505
|
+
function argumentsToArray() {
|
3506
|
+
var len = arguments.length, args = new Array(len);
|
3507
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
3508
|
+
return args;
|
3509
|
+
}
|
3510
|
+
|
3511
|
+
/**
|
3512
|
+
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
|
3513
|
+
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the args.
|
3514
|
+
* @returns {Observable} An observable sequence containing the result of combining elements of the args using the specified result selector function.
|
3515
|
+
*/
|
3516
|
+
observableProto.zipIterable = function () {
|
3517
|
+
if (arguments.length === 0) { throw new Error('invalid arguments'); }
|
3518
|
+
|
3519
|
+
var len = arguments.length, args = new Array(len);
|
3520
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
3521
|
+
var resultSelector = isFunction(args[len - 1]) ? args.pop() : argumentsToArray;
|
3522
|
+
|
3523
|
+
var parent = this;
|
3524
|
+
args.unshift(parent);
|
3525
|
+
return new AnonymousObservable(function (o) {
|
3526
|
+
var n = args.length,
|
3527
|
+
queues = arrayInitialize(n, emptyArrayFactory),
|
3528
|
+
isDone = arrayInitialize(n, falseFactory);
|
3529
|
+
|
3530
|
+
var subscriptions = new Array(n);
|
3531
|
+
for (var idx = 0; idx < n; idx++) {
|
3532
|
+
(function (i) {
|
3533
|
+
var source = args[i], sad = new SingleAssignmentDisposable();
|
3534
|
+
|
3535
|
+
(isArrayLike(source) || isIterable(source)) && (source = observableFrom(source));
|
3536
|
+
|
3537
|
+
sad.setDisposable(source.subscribe(function (x) {
|
3538
|
+
queues[i].push(x);
|
3539
|
+
if (queues.every(function (x) { return x.length > 0; })) {
|
3540
|
+
var queuedValues = queues.map(function (x) { return x.shift(); }),
|
3541
|
+
res = tryCatch(resultSelector).apply(parent, queuedValues);
|
3542
|
+
if (res === errorObj) { return o.onError(res.e); }
|
3543
|
+
o.onNext(res);
|
3544
|
+
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
3545
|
+
o.onCompleted();
|
3546
|
+
}
|
3547
|
+
}, function (e) { o.onError(e); }, function () {
|
3548
|
+
isDone[i] = true;
|
3549
|
+
isDone.every(identity) && o.onCompleted();
|
3550
|
+
}));
|
3551
|
+
subscriptions[i] = sad;
|
3552
|
+
})(idx);
|
3392
3553
|
}
|
3393
|
-
return new AnonymousObservable(function (observer) {
|
3394
|
-
var n = sources.length,
|
3395
|
-
queues = arrayInitialize(n, function () { return []; }),
|
3396
|
-
isDone = arrayInitialize(n, function () { return false; });
|
3397
|
-
|
3398
|
-
function next(i) {
|
3399
|
-
if (queues.every(function (x) { return x.length > 0; })) {
|
3400
|
-
var res = queues.map(function (x) { return x.shift(); });
|
3401
|
-
observer.onNext(res);
|
3402
|
-
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
3403
|
-
observer.onCompleted();
|
3404
|
-
return;
|
3405
|
-
}
|
3406
|
-
};
|
3407
|
-
|
3408
|
-
function done(i) {
|
3409
|
-
isDone[i] = true;
|
3410
|
-
if (isDone.every(identity)) {
|
3411
|
-
observer.onCompleted();
|
3412
|
-
return;
|
3413
|
-
}
|
3414
|
-
}
|
3415
3554
|
|
3416
|
-
|
3417
|
-
|
3418
|
-
|
3419
|
-
subscriptions[i] = new SingleAssignmentDisposable();
|
3420
|
-
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
|
3421
|
-
queues[i].push(x);
|
3422
|
-
next(i);
|
3423
|
-
}, function (e) { observer.onError(e); }, function () {
|
3424
|
-
done(i);
|
3425
|
-
}));
|
3426
|
-
})(idx);
|
3427
|
-
}
|
3555
|
+
return new CompositeDisposable(subscriptions);
|
3556
|
+
}, parent);
|
3557
|
+
};
|
3428
3558
|
|
3429
|
-
|
3430
|
-
|
3431
|
-
}
|
3559
|
+
function asObservable(source) {
|
3560
|
+
return function subscribe(o) { return source.subscribe(o); };
|
3561
|
+
}
|
3432
3562
|
|
3433
3563
|
/**
|
3434
3564
|
* Hides the identity of an observable sequence.
|
3435
3565
|
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
|
3436
3566
|
*/
|
3437
3567
|
observableProto.asObservable = function () {
|
3438
|
-
|
3439
|
-
return new AnonymousObservable(function (o) { return source.subscribe(o); }, this);
|
3568
|
+
return new AnonymousObservable(asObservable(this), this);
|
3440
3569
|
};
|
3441
3570
|
|
3442
3571
|
/**
|
@@ -3450,118 +3579,167 @@
|
|
3450
3579
|
}, this);
|
3451
3580
|
};
|
3452
3581
|
|
3582
|
+
var DistinctUntilChangedObservable = (function(__super__) {
|
3583
|
+
inherits(DistinctUntilChangedObservable, __super__);
|
3584
|
+
function DistinctUntilChangedObservable(source, keyFn, comparer) {
|
3585
|
+
this.source = source;
|
3586
|
+
this.keyFn = keyFn;
|
3587
|
+
this.comparer = comparer;
|
3588
|
+
__super__.call(this);
|
3589
|
+
}
|
3590
|
+
|
3591
|
+
DistinctUntilChangedObservable.prototype.subscribeCore = function (o) {
|
3592
|
+
return this.source.subscribe(new DistinctUntilChangedObserver(o, this.keyFn, this.comparer));
|
3593
|
+
};
|
3594
|
+
|
3595
|
+
return DistinctUntilChangedObservable;
|
3596
|
+
}(ObservableBase));
|
3597
|
+
|
3598
|
+
var DistinctUntilChangedObserver = (function(__super__) {
|
3599
|
+
inherits(DistinctUntilChangedObserver, __super__);
|
3600
|
+
function DistinctUntilChangedObserver(o, keyFn, comparer) {
|
3601
|
+
this.o = o;
|
3602
|
+
this.keyFn = keyFn;
|
3603
|
+
this.comparer = comparer;
|
3604
|
+
this.hasCurrentKey = false;
|
3605
|
+
this.currentKey = null;
|
3606
|
+
__super__.call(this);
|
3607
|
+
}
|
3608
|
+
|
3609
|
+
DistinctUntilChangedObserver.prototype.next = function (x) {
|
3610
|
+
var key = x, comparerEquals;
|
3611
|
+
if (isFunction(this.keyFn)) {
|
3612
|
+
key = tryCatch(this.keyFn)(x);
|
3613
|
+
if (key === errorObj) { return this.o.onError(key.e); }
|
3614
|
+
}
|
3615
|
+
if (this.hasCurrentKey) {
|
3616
|
+
comparerEquals = tryCatch(this.comparer)(this.currentKey, key);
|
3617
|
+
if (comparerEquals === errorObj) { return this.o.onError(comparerEquals.e); }
|
3618
|
+
}
|
3619
|
+
if (!this.hasCurrentKey || !comparerEquals) {
|
3620
|
+
this.hasCurrentKey = true;
|
3621
|
+
this.currentKey = key;
|
3622
|
+
this.o.onNext(x);
|
3623
|
+
}
|
3624
|
+
};
|
3625
|
+
DistinctUntilChangedObserver.prototype.error = function(e) {
|
3626
|
+
this.o.onError(e);
|
3627
|
+
};
|
3628
|
+
DistinctUntilChangedObserver.prototype.completed = function () {
|
3629
|
+
this.o.onCompleted();
|
3630
|
+
};
|
3631
|
+
|
3632
|
+
return DistinctUntilChangedObserver;
|
3633
|
+
}(AbstractObserver));
|
3634
|
+
|
3453
3635
|
/**
|
3454
|
-
|
3455
|
-
|
3456
|
-
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
3460
|
-
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
|
3461
|
-
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
|
3462
|
-
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
|
3463
|
-
*/
|
3464
|
-
observableProto.distinctUntilChanged = function (keySelector, comparer) {
|
3465
|
-
var source = this;
|
3636
|
+
* Returns an observable sequence that contains only distinct contiguous elements according to the keyFn and the comparer.
|
3637
|
+
* @param {Function} [keyFn] A function to compute the comparison key for each element. If not provided, it projects the value.
|
3638
|
+
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
|
3639
|
+
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
|
3640
|
+
*/
|
3641
|
+
observableProto.distinctUntilChanged = function (keyFn, comparer) {
|
3466
3642
|
comparer || (comparer = defaultComparer);
|
3467
|
-
return new
|
3468
|
-
var hasCurrentKey = false, currentKey;
|
3469
|
-
return source.subscribe(function (value) {
|
3470
|
-
var key = value;
|
3471
|
-
if (keySelector) {
|
3472
|
-
try {
|
3473
|
-
key = keySelector(value);
|
3474
|
-
} catch (e) {
|
3475
|
-
o.onError(e);
|
3476
|
-
return;
|
3477
|
-
}
|
3478
|
-
}
|
3479
|
-
if (hasCurrentKey) {
|
3480
|
-
try {
|
3481
|
-
var comparerEquals = comparer(currentKey, key);
|
3482
|
-
} catch (e) {
|
3483
|
-
o.onError(e);
|
3484
|
-
return;
|
3485
|
-
}
|
3486
|
-
}
|
3487
|
-
if (!hasCurrentKey || !comparerEquals) {
|
3488
|
-
hasCurrentKey = true;
|
3489
|
-
currentKey = key;
|
3490
|
-
o.onNext(value);
|
3491
|
-
}
|
3492
|
-
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
|
3493
|
-
}, this);
|
3643
|
+
return new DistinctUntilChangedObservable(this, keyFn, comparer);
|
3494
3644
|
};
|
3495
3645
|
|
3646
|
+
var TapObservable = (function(__super__) {
|
3647
|
+
inherits(TapObservable,__super__);
|
3648
|
+
function TapObservable(source, observerOrOnNext, onError, onCompleted) {
|
3649
|
+
this.source = source;
|
3650
|
+
this._oN = observerOrOnNext;
|
3651
|
+
this._oE = onError;
|
3652
|
+
this._oC = onCompleted;
|
3653
|
+
__super__.call(this);
|
3654
|
+
}
|
3655
|
+
|
3656
|
+
TapObservable.prototype.subscribeCore = function(o) {
|
3657
|
+
return this.source.subscribe(new InnerObserver(o, this));
|
3658
|
+
};
|
3659
|
+
|
3660
|
+
function InnerObserver(o, p) {
|
3661
|
+
this.o = o;
|
3662
|
+
this.t = !p._oN || isFunction(p._oN) ?
|
3663
|
+
observerCreate(p._oN || noop, p._oE || noop, p._oC || noop) :
|
3664
|
+
p._oN;
|
3665
|
+
this.isStopped = false;
|
3666
|
+
}
|
3667
|
+
InnerObserver.prototype.onNext = function(x) {
|
3668
|
+
if (this.isStopped) { return; }
|
3669
|
+
var res = tryCatch(this.t.onNext).call(this.t, x);
|
3670
|
+
if (res === errorObj) { this.o.onError(res.e); }
|
3671
|
+
this.o.onNext(x);
|
3672
|
+
};
|
3673
|
+
InnerObserver.prototype.onError = function(err) {
|
3674
|
+
if (!this.isStopped) {
|
3675
|
+
this.isStopped = true;
|
3676
|
+
var res = tryCatch(this.t.onError).call(this.t, err);
|
3677
|
+
if (res === errorObj) { return this.o.onError(res.e); }
|
3678
|
+
this.o.onError(err);
|
3679
|
+
}
|
3680
|
+
};
|
3681
|
+
InnerObserver.prototype.onCompleted = function() {
|
3682
|
+
if (!this.isStopped) {
|
3683
|
+
this.isStopped = true;
|
3684
|
+
var res = tryCatch(this.t.onCompleted).call(this.t);
|
3685
|
+
if (res === errorObj) { return this.o.onError(res.e); }
|
3686
|
+
this.o.onCompleted();
|
3687
|
+
}
|
3688
|
+
};
|
3689
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
3690
|
+
InnerObserver.prototype.fail = function (e) {
|
3691
|
+
if (!this.isStopped) {
|
3692
|
+
this.isStopped = true;
|
3693
|
+
this.o.onError(e);
|
3694
|
+
return true;
|
3695
|
+
}
|
3696
|
+
return false;
|
3697
|
+
};
|
3698
|
+
|
3699
|
+
return TapObservable;
|
3700
|
+
}(ObservableBase));
|
3701
|
+
|
3496
3702
|
/**
|
3497
|
-
|
3498
|
-
|
3499
|
-
|
3500
|
-
|
3501
|
-
|
3502
|
-
|
3503
|
-
|
3703
|
+
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
|
3704
|
+
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
3705
|
+
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an o.
|
3706
|
+
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
|
3707
|
+
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
|
3708
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
3709
|
+
*/
|
3504
3710
|
observableProto['do'] = observableProto.tap = observableProto.doAction = function (observerOrOnNext, onError, onCompleted) {
|
3505
|
-
|
3506
|
-
return new AnonymousObservable(function (observer) {
|
3507
|
-
var tapObserver = !observerOrOnNext || isFunction(observerOrOnNext) ?
|
3508
|
-
observerCreate(observerOrOnNext || noop, onError || noop, onCompleted || noop) :
|
3509
|
-
observerOrOnNext;
|
3510
|
-
|
3511
|
-
return source.subscribe(function (x) {
|
3512
|
-
try {
|
3513
|
-
tapObserver.onNext(x);
|
3514
|
-
} catch (e) {
|
3515
|
-
observer.onError(e);
|
3516
|
-
}
|
3517
|
-
observer.onNext(x);
|
3518
|
-
}, function (err) {
|
3519
|
-
try {
|
3520
|
-
tapObserver.onError(err);
|
3521
|
-
} catch (e) {
|
3522
|
-
observer.onError(e);
|
3523
|
-
}
|
3524
|
-
observer.onError(err);
|
3525
|
-
}, function () {
|
3526
|
-
try {
|
3527
|
-
tapObserver.onCompleted();
|
3528
|
-
} catch (e) {
|
3529
|
-
observer.onError(e);
|
3530
|
-
}
|
3531
|
-
observer.onCompleted();
|
3532
|
-
});
|
3533
|
-
}, this);
|
3711
|
+
return new TapObservable(this, observerOrOnNext, onError, onCompleted);
|
3534
3712
|
};
|
3535
3713
|
|
3536
3714
|
/**
|
3537
|
-
|
3538
|
-
|
3539
|
-
|
3540
|
-
|
3541
|
-
|
3542
|
-
|
3715
|
+
* Invokes an action for each element in the observable sequence.
|
3716
|
+
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
3717
|
+
* @param {Function} onNext Action to invoke for each element in the observable sequence.
|
3718
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3719
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
3720
|
+
*/
|
3543
3721
|
observableProto.doOnNext = observableProto.tapOnNext = function (onNext, thisArg) {
|
3544
3722
|
return this.tap(typeof thisArg !== 'undefined' ? function (x) { onNext.call(thisArg, x); } : onNext);
|
3545
3723
|
};
|
3546
3724
|
|
3547
3725
|
/**
|
3548
|
-
|
3549
|
-
|
3550
|
-
|
3551
|
-
|
3552
|
-
|
3553
|
-
|
3726
|
+
* Invokes an action upon exceptional termination of the observable sequence.
|
3727
|
+
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
3728
|
+
* @param {Function} onError Action to invoke upon exceptional termination of the observable sequence.
|
3729
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3730
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
3731
|
+
*/
|
3554
3732
|
observableProto.doOnError = observableProto.tapOnError = function (onError, thisArg) {
|
3555
3733
|
return this.tap(noop, typeof thisArg !== 'undefined' ? function (e) { onError.call(thisArg, e); } : onError);
|
3556
3734
|
};
|
3557
3735
|
|
3558
3736
|
/**
|
3559
|
-
|
3560
|
-
|
3561
|
-
|
3562
|
-
|
3563
|
-
|
3564
|
-
|
3737
|
+
* Invokes an action upon graceful termination of the observable sequence.
|
3738
|
+
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
|
3739
|
+
* @param {Function} onCompleted Action to invoke upon graceful termination of the observable sequence.
|
3740
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3741
|
+
* @returns {Observable} The source sequence with the side-effecting behavior applied.
|
3742
|
+
*/
|
3565
3743
|
observableProto.doOnCompleted = observableProto.tapOnCompleted = function (onCompleted, thisArg) {
|
3566
3744
|
return this.tap(noop, null, typeof thisArg !== 'undefined' ? function () { onCompleted.call(thisArg); } : onCompleted);
|
3567
3745
|
};
|
@@ -3571,45 +3749,71 @@
|
|
3571
3749
|
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
|
3572
3750
|
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
|
3573
3751
|
*/
|
3574
|
-
observableProto['finally'] =
|
3752
|
+
observableProto['finally'] = function (action) {
|
3575
3753
|
var source = this;
|
3576
3754
|
return new AnonymousObservable(function (observer) {
|
3577
|
-
var subscription;
|
3578
|
-
|
3579
|
-
subscription = source.subscribe(observer);
|
3580
|
-
} catch (e) {
|
3755
|
+
var subscription = tryCatch(source.subscribe).call(source, observer);
|
3756
|
+
if (subscription === errorObj) {
|
3581
3757
|
action();
|
3582
|
-
|
3758
|
+
return thrower(subscription.e);
|
3583
3759
|
}
|
3584
3760
|
return disposableCreate(function () {
|
3585
|
-
|
3586
|
-
|
3587
|
-
|
3588
|
-
throw e;
|
3589
|
-
} finally {
|
3590
|
-
action();
|
3591
|
-
}
|
3761
|
+
var r = tryCatch(subscription.dispose).call(subscription);
|
3762
|
+
action();
|
3763
|
+
r === errorObj && thrower(r.e);
|
3592
3764
|
});
|
3593
3765
|
}, this);
|
3594
3766
|
};
|
3595
3767
|
|
3596
|
-
|
3597
|
-
|
3598
|
-
|
3599
|
-
|
3600
|
-
|
3601
|
-
|
3602
|
-
|
3768
|
+
var IgnoreElementsObservable = (function(__super__) {
|
3769
|
+
inherits(IgnoreElementsObservable, __super__);
|
3770
|
+
|
3771
|
+
function IgnoreElementsObservable(source) {
|
3772
|
+
this.source = source;
|
3773
|
+
__super__.call(this);
|
3774
|
+
}
|
3775
|
+
|
3776
|
+
IgnoreElementsObservable.prototype.subscribeCore = function (o) {
|
3777
|
+
return this.source.subscribe(new InnerObserver(o));
|
3778
|
+
};
|
3779
|
+
|
3780
|
+
function InnerObserver(o) {
|
3781
|
+
this.o = o;
|
3782
|
+
this.isStopped = false;
|
3783
|
+
}
|
3784
|
+
InnerObserver.prototype.onNext = noop;
|
3785
|
+
InnerObserver.prototype.onError = function (err) {
|
3786
|
+
if(!this.isStopped) {
|
3787
|
+
this.isStopped = true;
|
3788
|
+
this.o.onError(err);
|
3789
|
+
}
|
3790
|
+
};
|
3791
|
+
InnerObserver.prototype.onCompleted = function () {
|
3792
|
+
if(!this.isStopped) {
|
3793
|
+
this.isStopped = true;
|
3794
|
+
this.o.onCompleted();
|
3795
|
+
}
|
3796
|
+
};
|
3797
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
3798
|
+
InnerObserver.prototype.fail = function (e) {
|
3799
|
+
if (!this.isStopped) {
|
3800
|
+
this.isStopped = true;
|
3801
|
+
this.observer.onError(e);
|
3802
|
+
return true;
|
3803
|
+
}
|
3804
|
+
|
3805
|
+
return false;
|
3806
|
+
};
|
3807
|
+
|
3808
|
+
return IgnoreElementsObservable;
|
3809
|
+
}(ObservableBase));
|
3603
3810
|
|
3604
3811
|
/**
|
3605
3812
|
* Ignores all elements in an observable sequence leaving only the termination messages.
|
3606
3813
|
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
|
3607
3814
|
*/
|
3608
3815
|
observableProto.ignoreElements = function () {
|
3609
|
-
|
3610
|
-
return new AnonymousObservable(function (o) {
|
3611
|
-
return source.subscribe(noop, function (e) { o.onError(e); }, function () { o.onCompleted(); });
|
3612
|
-
}, source);
|
3816
|
+
return new IgnoreElementsObservable(this);
|
3613
3817
|
};
|
3614
3818
|
|
3615
3819
|
/**
|
@@ -3667,51 +3871,84 @@
|
|
3667
3871
|
observableProto.retryWhen = function (notifier) {
|
3668
3872
|
return enumerableRepeat(this).catchErrorWhen(notifier);
|
3669
3873
|
};
|
3874
|
+
var ScanObservable = (function(__super__) {
|
3875
|
+
inherits(ScanObservable, __super__);
|
3876
|
+
function ScanObservable(source, accumulator, hasSeed, seed) {
|
3877
|
+
this.source = source;
|
3878
|
+
this.accumulator = accumulator;
|
3879
|
+
this.hasSeed = hasSeed;
|
3880
|
+
this.seed = seed;
|
3881
|
+
__super__.call(this);
|
3882
|
+
}
|
3883
|
+
|
3884
|
+
ScanObservable.prototype.subscribeCore = function(o) {
|
3885
|
+
return this.source.subscribe(new InnerObserver(o,this));
|
3886
|
+
};
|
3887
|
+
|
3888
|
+
return ScanObservable;
|
3889
|
+
}(ObservableBase));
|
3890
|
+
|
3891
|
+
function InnerObserver(o, parent) {
|
3892
|
+
this.o = o;
|
3893
|
+
this.accumulator = parent.accumulator;
|
3894
|
+
this.hasSeed = parent.hasSeed;
|
3895
|
+
this.seed = parent.seed;
|
3896
|
+
this.hasAccumulation = false;
|
3897
|
+
this.accumulation = null;
|
3898
|
+
this.hasValue = false;
|
3899
|
+
this.isStopped = false;
|
3900
|
+
}
|
3901
|
+
InnerObserver.prototype = {
|
3902
|
+
onNext: function (x) {
|
3903
|
+
if (this.isStopped) { return; }
|
3904
|
+
!this.hasValue && (this.hasValue = true);
|
3905
|
+
if (this.hasAccumulation) {
|
3906
|
+
this.accumulation = tryCatch(this.accumulator)(this.accumulation, x);
|
3907
|
+
} else {
|
3908
|
+
this.accumulation = this.hasSeed ? tryCatch(this.accumulator)(this.seed, x) : x;
|
3909
|
+
this.hasAccumulation = true;
|
3910
|
+
}
|
3911
|
+
if (this.accumulation === errorObj) { return this.o.onError(this.accumulation.e); }
|
3912
|
+
this.o.onNext(this.accumulation);
|
3913
|
+
},
|
3914
|
+
onError: function (e) {
|
3915
|
+
if (!this.isStopped) {
|
3916
|
+
this.isStopped = true;
|
3917
|
+
this.o.onError(e);
|
3918
|
+
}
|
3919
|
+
},
|
3920
|
+
onCompleted: function () {
|
3921
|
+
if (!this.isStopped) {
|
3922
|
+
this.isStopped = true;
|
3923
|
+
!this.hasValue && this.hasSeed && this.o.onNext(this.seed);
|
3924
|
+
this.o.onCompleted();
|
3925
|
+
}
|
3926
|
+
},
|
3927
|
+
dispose: function() { this.isStopped = true; },
|
3928
|
+
fail: function (e) {
|
3929
|
+
if (!this.isStopped) {
|
3930
|
+
this.isStopped = true;
|
3931
|
+
this.o.onError(e);
|
3932
|
+
return true;
|
3933
|
+
}
|
3934
|
+
return false;
|
3935
|
+
}
|
3936
|
+
};
|
3937
|
+
|
3670
3938
|
/**
|
3671
|
-
|
3672
|
-
|
3673
|
-
|
3674
|
-
|
3675
|
-
|
3676
|
-
|
3677
|
-
* @param {Function} accumulator An accumulator function to be invoked on each element.
|
3678
|
-
* @returns {Observable} An observable sequence containing the accumulated values.
|
3679
|
-
*/
|
3939
|
+
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
|
3940
|
+
* For aggregation behavior with no intermediate results, see Observable.aggregate.
|
3941
|
+
* @param {Mixed} [seed] The initial accumulator value.
|
3942
|
+
* @param {Function} accumulator An accumulator function to be invoked on each element.
|
3943
|
+
* @returns {Observable} An observable sequence containing the accumulated values.
|
3944
|
+
*/
|
3680
3945
|
observableProto.scan = function () {
|
3681
|
-
var hasSeed = false, seed, accumulator
|
3946
|
+
var hasSeed = false, seed, accumulator = arguments[0];
|
3682
3947
|
if (arguments.length === 2) {
|
3683
3948
|
hasSeed = true;
|
3684
|
-
seed = arguments[
|
3685
|
-
accumulator = arguments[1];
|
3686
|
-
} else {
|
3687
|
-
accumulator = arguments[0];
|
3949
|
+
seed = arguments[1];
|
3688
3950
|
}
|
3689
|
-
return new
|
3690
|
-
var hasAccumulation, accumulation, hasValue;
|
3691
|
-
return source.subscribe (
|
3692
|
-
function (x) {
|
3693
|
-
!hasValue && (hasValue = true);
|
3694
|
-
try {
|
3695
|
-
if (hasAccumulation) {
|
3696
|
-
accumulation = accumulator(accumulation, x);
|
3697
|
-
} else {
|
3698
|
-
accumulation = hasSeed ? accumulator(seed, x) : x;
|
3699
|
-
hasAccumulation = true;
|
3700
|
-
}
|
3701
|
-
} catch (e) {
|
3702
|
-
o.onError(e);
|
3703
|
-
return;
|
3704
|
-
}
|
3705
|
-
|
3706
|
-
o.onNext(accumulation);
|
3707
|
-
},
|
3708
|
-
function (e) { o.onError(e); },
|
3709
|
-
function () {
|
3710
|
-
!hasValue && hasSeed && o.onNext(seed);
|
3711
|
-
o.onCompleted();
|
3712
|
-
}
|
3713
|
-
);
|
3714
|
-
}, source);
|
3951
|
+
return new ScanObservable(this, accumulator, hasSeed, seed);
|
3715
3952
|
};
|
3716
3953
|
|
3717
3954
|
/**
|
@@ -3777,52 +4014,9 @@
|
|
3777
4014
|
}, source);
|
3778
4015
|
};
|
3779
4016
|
|
3780
|
-
|
3781
|
-
|
3782
|
-
|
3783
|
-
var result = selectorFunc(x, i, source);
|
3784
|
-
isPromise(result) && (result = observableFromPromise(result));
|
3785
|
-
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
|
3786
|
-
return result;
|
3787
|
-
}).concatAll();
|
3788
|
-
}
|
3789
|
-
|
3790
|
-
/**
|
3791
|
-
* One of the Following:
|
3792
|
-
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
|
3793
|
-
*
|
3794
|
-
* @example
|
3795
|
-
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
|
3796
|
-
* Or:
|
3797
|
-
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
|
3798
|
-
*
|
3799
|
-
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
|
3800
|
-
* Or:
|
3801
|
-
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
|
3802
|
-
*
|
3803
|
-
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
|
3804
|
-
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
|
3805
|
-
* source sequence onto which could be either an observable or Promise.
|
3806
|
-
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
|
3807
|
-
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
|
3808
|
-
*/
|
3809
|
-
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
|
3810
|
-
if (isFunction(selector) && isFunction(resultSelector)) {
|
3811
|
-
return this.concatMap(function (x, i) {
|
3812
|
-
var selectorResult = selector(x, i);
|
3813
|
-
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
|
3814
|
-
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
|
3815
|
-
|
3816
|
-
return selectorResult.map(function (y, i2) {
|
3817
|
-
return resultSelector(x, y, i, i2);
|
3818
|
-
});
|
3819
|
-
});
|
3820
|
-
}
|
3821
|
-
return isFunction(selector) ?
|
3822
|
-
concatMap(this, selector, thisArg) :
|
3823
|
-
concatMap(this, function () { return selector; });
|
3824
|
-
};
|
3825
|
-
|
4017
|
+
observableProto.flatMapConcat = observableProto.concatMap = function(selector, resultSelector, thisArg) {
|
4018
|
+
return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(1);
|
4019
|
+
};
|
3826
4020
|
var MapObservable = (function (__super__) {
|
3827
4021
|
inherits(MapObservable, __super__);
|
3828
4022
|
|
@@ -3832,51 +4026,52 @@
|
|
3832
4026
|
__super__.call(this);
|
3833
4027
|
}
|
3834
4028
|
|
4029
|
+
function innerMap(selector, self) {
|
4030
|
+
return function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }
|
4031
|
+
}
|
4032
|
+
|
3835
4033
|
MapObservable.prototype.internalMap = function (selector, thisArg) {
|
3836
|
-
|
3837
|
-
return new MapObservable(this.source, function (x, i, o) { return selector.call(this, self.selector(x, i, o), i, o); }, thisArg)
|
4034
|
+
return new MapObservable(this.source, innerMap(selector, this), thisArg);
|
3838
4035
|
};
|
3839
4036
|
|
3840
|
-
MapObservable.prototype.subscribeCore = function (
|
3841
|
-
return this.source.subscribe(new
|
4037
|
+
MapObservable.prototype.subscribeCore = function (o) {
|
4038
|
+
return this.source.subscribe(new InnerObserver(o, this.selector, this));
|
3842
4039
|
};
|
3843
4040
|
|
3844
|
-
|
4041
|
+
function InnerObserver(o, selector, source) {
|
4042
|
+
this.o = o;
|
4043
|
+
this.selector = selector;
|
4044
|
+
this.source = source;
|
4045
|
+
this.i = 0;
|
4046
|
+
this.isStopped = false;
|
4047
|
+
}
|
3845
4048
|
|
3846
|
-
|
4049
|
+
InnerObserver.prototype.onNext = function(x) {
|
4050
|
+
if (this.isStopped) { return; }
|
4051
|
+
var result = tryCatch(this.selector)(x, this.i++, this.source);
|
4052
|
+
if (result === errorObj) { return this.o.onError(result.e); }
|
4053
|
+
this.o.onNext(result);
|
4054
|
+
};
|
4055
|
+
InnerObserver.prototype.onError = function (e) {
|
4056
|
+
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
|
4057
|
+
};
|
4058
|
+
InnerObserver.prototype.onCompleted = function () {
|
4059
|
+
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
|
4060
|
+
};
|
4061
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
4062
|
+
InnerObserver.prototype.fail = function (e) {
|
4063
|
+
if (!this.isStopped) {
|
4064
|
+
this.isStopped = true;
|
4065
|
+
this.o.onError(e);
|
4066
|
+
return true;
|
4067
|
+
}
|
3847
4068
|
|
3848
|
-
|
3849
|
-
|
3850
|
-
this.selector = selector;
|
3851
|
-
this.source = source;
|
3852
|
-
this.i = 0;
|
3853
|
-
this.isStopped = false;
|
3854
|
-
}
|
4069
|
+
return false;
|
4070
|
+
};
|
3855
4071
|
|
3856
|
-
|
3857
|
-
if (this.isStopped) { return; }
|
3858
|
-
var result = tryCatch(this.selector).call(this, x, this.i++, this.source);
|
3859
|
-
if (result === errorObj) {
|
3860
|
-
return this.observer.onError(result.e);
|
3861
|
-
}
|
3862
|
-
this.observer.onNext(result);
|
3863
|
-
};
|
3864
|
-
MapObserver.prototype.onError = function (e) {
|
3865
|
-
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
|
3866
|
-
};
|
3867
|
-
MapObserver.prototype.onCompleted = function () {
|
3868
|
-
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
|
3869
|
-
};
|
3870
|
-
MapObserver.prototype.dispose = function() { this.isStopped = true; };
|
3871
|
-
MapObserver.prototype.fail = function (e) {
|
3872
|
-
if (!this.isStopped) {
|
3873
|
-
this.isStopped = true;
|
3874
|
-
this.observer.onError(e);
|
3875
|
-
return true;
|
3876
|
-
}
|
4072
|
+
return MapObservable;
|
3877
4073
|
|
3878
|
-
|
3879
|
-
};
|
4074
|
+
}(ObservableBase));
|
3880
4075
|
|
3881
4076
|
/**
|
3882
4077
|
* Projects each element of an observable sequence into a new form by incorporating the element's index.
|
@@ -3891,16 +4086,8 @@
|
|
3891
4086
|
new MapObservable(this, selectorFn, thisArg);
|
3892
4087
|
};
|
3893
4088
|
|
3894
|
-
|
3895
|
-
|
3896
|
-
* the Observable sequence.
|
3897
|
-
* @param {Arguments} arguments The nested properties to pluck.
|
3898
|
-
* @returns {Observable} Returns a new Observable sequence of property values.
|
3899
|
-
*/
|
3900
|
-
observableProto.pluck = function () {
|
3901
|
-
var args = arguments, len = arguments.length;
|
3902
|
-
if (len === 0) { throw new Error('List of properties cannot be empty.'); }
|
3903
|
-
return this.map(function (x) {
|
4089
|
+
function plucker(args, len) {
|
4090
|
+
return function mapper(x) {
|
3904
4091
|
var currentProp = x;
|
3905
4092
|
for (var i = 0; i < len; i++) {
|
3906
4093
|
var p = currentProp[args[i]];
|
@@ -3911,67 +4098,81 @@
|
|
3911
4098
|
}
|
3912
4099
|
}
|
3913
4100
|
return currentProp;
|
3914
|
-
}
|
3915
|
-
};
|
3916
|
-
|
3917
|
-
function flatMap(source, selector, thisArg) {
|
3918
|
-
var selectorFunc = bindCallback(selector, thisArg, 3);
|
3919
|
-
return source.map(function (x, i) {
|
3920
|
-
var result = selectorFunc(x, i, source);
|
3921
|
-
isPromise(result) && (result = observableFromPromise(result));
|
3922
|
-
(isArrayLike(result) || isIterable(result)) && (result = observableFrom(result));
|
3923
|
-
return result;
|
3924
|
-
}).mergeAll();
|
4101
|
+
}
|
3925
4102
|
}
|
3926
4103
|
|
3927
4104
|
/**
|
3928
|
-
*
|
3929
|
-
*
|
3930
|
-
*
|
3931
|
-
* @
|
3932
|
-
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
|
3933
|
-
* Or:
|
3934
|
-
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
|
3935
|
-
*
|
3936
|
-
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
|
3937
|
-
* Or:
|
3938
|
-
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
|
3939
|
-
*
|
3940
|
-
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
|
3941
|
-
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto which could be either an observable or Promise.
|
3942
|
-
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
|
3943
|
-
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3944
|
-
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
|
4105
|
+
* Retrieves the value of a specified nested property from all elements in
|
4106
|
+
* the Observable sequence.
|
4107
|
+
* @param {Arguments} arguments The nested properties to pluck.
|
4108
|
+
* @returns {Observable} Returns a new Observable sequence of property values.
|
3945
4109
|
*/
|
3946
|
-
observableProto.
|
3947
|
-
|
3948
|
-
|
3949
|
-
|
3950
|
-
|
3951
|
-
(isArrayLike(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
|
3952
|
-
|
3953
|
-
return selectorResult.map(function (y, i2) {
|
3954
|
-
return resultSelector(x, y, i, i2);
|
3955
|
-
});
|
3956
|
-
}, thisArg);
|
3957
|
-
}
|
3958
|
-
return isFunction(selector) ?
|
3959
|
-
flatMap(this, selector, thisArg) :
|
3960
|
-
flatMap(this, function () { return selector; });
|
4110
|
+
observableProto.pluck = function () {
|
4111
|
+
var len = arguments.length, args = new Array(len);
|
4112
|
+
if (len === 0) { throw new Error('List of properties cannot be empty.'); }
|
4113
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
4114
|
+
return this.map(plucker(args, len));
|
3961
4115
|
};
|
3962
4116
|
|
3963
|
-
|
3964
|
-
|
3965
|
-
|
3966
|
-
|
3967
|
-
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3968
|
-
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
|
3969
|
-
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
|
3970
|
-
*/
|
3971
|
-
observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) {
|
3972
|
-
return this.select(selector, thisArg).switchLatest();
|
3973
|
-
};
|
4117
|
+
observableProto.flatMap = observableProto.selectMany = function(selector, resultSelector, thisArg) {
|
4118
|
+
return new FlatMapObservable(this, selector, resultSelector, thisArg).mergeAll();
|
4119
|
+
};
|
4120
|
+
|
3974
4121
|
|
4122
|
+
//
|
4123
|
+
//Rx.Observable.prototype.flatMapWithMaxConcurrent = function(limit, selector, resultSelector, thisArg) {
|
4124
|
+
// return new FlatMapObservable(this, selector, resultSelector, thisArg).merge(limit);
|
4125
|
+
//};
|
4126
|
+
//
|
4127
|
+
|
4128
|
+
Rx.Observable.prototype.flatMapLatest = function(selector, resultSelector, thisArg) {
|
4129
|
+
return new FlatMapObservable(this, selector, resultSelector, thisArg).switchLatest();
|
4130
|
+
};
|
4131
|
+
var SkipObservable = (function(__super__) {
|
4132
|
+
inherits(SkipObservable, __super__);
|
4133
|
+
function SkipObservable(source, count) {
|
4134
|
+
this.source = source;
|
4135
|
+
this.skipCount = count;
|
4136
|
+
__super__.call(this);
|
4137
|
+
}
|
4138
|
+
|
4139
|
+
SkipObservable.prototype.subscribeCore = function (o) {
|
4140
|
+
return this.source.subscribe(new InnerObserver(o, this.skipCount));
|
4141
|
+
};
|
4142
|
+
|
4143
|
+
function InnerObserver(o, c) {
|
4144
|
+
this.c = c;
|
4145
|
+
this.r = c;
|
4146
|
+
this.o = o;
|
4147
|
+
this.isStopped = false;
|
4148
|
+
}
|
4149
|
+
InnerObserver.prototype.onNext = function (x) {
|
4150
|
+
if (this.isStopped) { return; }
|
4151
|
+
if (this.r <= 0) {
|
4152
|
+
this.o.onNext(x);
|
4153
|
+
} else {
|
4154
|
+
this.r--;
|
4155
|
+
}
|
4156
|
+
};
|
4157
|
+
InnerObserver.prototype.onError = function(e) {
|
4158
|
+
if (!this.isStopped) { this.isStopped = true; this.o.onError(e); }
|
4159
|
+
};
|
4160
|
+
InnerObserver.prototype.onCompleted = function() {
|
4161
|
+
if (!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
|
4162
|
+
};
|
4163
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
4164
|
+
InnerObserver.prototype.fail = function(e) {
|
4165
|
+
if (!this.isStopped) {
|
4166
|
+
this.isStopped = true;
|
4167
|
+
this.o.onError(e);
|
4168
|
+
return true;
|
4169
|
+
}
|
4170
|
+
return false;
|
4171
|
+
};
|
4172
|
+
|
4173
|
+
return SkipObservable;
|
4174
|
+
}(ObservableBase));
|
4175
|
+
|
3975
4176
|
/**
|
3976
4177
|
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
|
3977
4178
|
* @param {Number} count The number of elements to skip before returning the remaining elements.
|
@@ -3979,19 +4180,8 @@
|
|
3979
4180
|
*/
|
3980
4181
|
observableProto.skip = function (count) {
|
3981
4182
|
if (count < 0) { throw new ArgumentOutOfRangeError(); }
|
3982
|
-
|
3983
|
-
return new AnonymousObservable(function (o) {
|
3984
|
-
var remaining = count;
|
3985
|
-
return source.subscribe(function (x) {
|
3986
|
-
if (remaining <= 0) {
|
3987
|
-
o.onNext(x);
|
3988
|
-
} else {
|
3989
|
-
remaining--;
|
3990
|
-
}
|
3991
|
-
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
|
3992
|
-
}, source);
|
4183
|
+
return new SkipObservable(this, count);
|
3993
4184
|
};
|
3994
|
-
|
3995
4185
|
/**
|
3996
4186
|
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
|
3997
4187
|
* The element's index is used in the logic of the predicate function.
|
@@ -4039,7 +4229,7 @@
|
|
4039
4229
|
return source.subscribe(function (x) {
|
4040
4230
|
if (remaining-- > 0) {
|
4041
4231
|
o.onNext(x);
|
4042
|
-
remaining
|
4232
|
+
remaining <= 0 && o.onCompleted();
|
4043
4233
|
}
|
4044
4234
|
}, function (e) { o.onError(e); }, function () { o.onCompleted(); });
|
4045
4235
|
}, source);
|
@@ -4084,51 +4274,54 @@
|
|
4084
4274
|
__super__.call(this);
|
4085
4275
|
}
|
4086
4276
|
|
4087
|
-
FilterObservable.prototype.subscribeCore = function (
|
4088
|
-
return this.source.subscribe(new
|
4277
|
+
FilterObservable.prototype.subscribeCore = function (o) {
|
4278
|
+
return this.source.subscribe(new InnerObserver(o, this.predicate, this));
|
4089
4279
|
};
|
4280
|
+
|
4281
|
+
function innerPredicate(predicate, self) {
|
4282
|
+
return function(x, i, o) { return self.predicate(x, i, o) && predicate.call(this, x, i, o); }
|
4283
|
+
}
|
4090
4284
|
|
4091
4285
|
FilterObservable.prototype.internalFilter = function(predicate, thisArg) {
|
4092
|
-
|
4093
|
-
|
4286
|
+
return new FilterObservable(this.source, innerPredicate(predicate, this), thisArg);
|
4287
|
+
};
|
4288
|
+
|
4289
|
+
function InnerObserver(o, predicate, source) {
|
4290
|
+
this.o = o;
|
4291
|
+
this.predicate = predicate;
|
4292
|
+
this.source = source;
|
4293
|
+
this.i = 0;
|
4294
|
+
this.isStopped = false;
|
4295
|
+
}
|
4296
|
+
|
4297
|
+
InnerObserver.prototype.onNext = function(x) {
|
4298
|
+
if (this.isStopped) { return; }
|
4299
|
+
var shouldYield = tryCatch(this.predicate)(x, this.i++, this.source);
|
4300
|
+
if (shouldYield === errorObj) {
|
4301
|
+
return this.o.onError(shouldYield.e);
|
4302
|
+
}
|
4303
|
+
shouldYield && this.o.onNext(x);
|
4304
|
+
};
|
4305
|
+
InnerObserver.prototype.onError = function (e) {
|
4306
|
+
if(!this.isStopped) { this.isStopped = true; this.o.onError(e); }
|
4307
|
+
};
|
4308
|
+
InnerObserver.prototype.onCompleted = function () {
|
4309
|
+
if(!this.isStopped) { this.isStopped = true; this.o.onCompleted(); }
|
4310
|
+
};
|
4311
|
+
InnerObserver.prototype.dispose = function() { this.isStopped = true; };
|
4312
|
+
InnerObserver.prototype.fail = function (e) {
|
4313
|
+
if (!this.isStopped) {
|
4314
|
+
this.isStopped = true;
|
4315
|
+
this.o.onError(e);
|
4316
|
+
return true;
|
4317
|
+
}
|
4318
|
+
return false;
|
4094
4319
|
};
|
4095
4320
|
|
4096
4321
|
return FilterObservable;
|
4097
4322
|
|
4098
4323
|
}(ObservableBase));
|
4099
4324
|
|
4100
|
-
function FilterObserver(observer, predicate, source) {
|
4101
|
-
this.observer = observer;
|
4102
|
-
this.predicate = predicate;
|
4103
|
-
this.source = source;
|
4104
|
-
this.i = 0;
|
4105
|
-
this.isStopped = false;
|
4106
|
-
}
|
4107
|
-
|
4108
|
-
FilterObserver.prototype.onNext = function(x) {
|
4109
|
-
if (this.isStopped) { return; }
|
4110
|
-
var shouldYield = tryCatch(this.predicate).call(this, x, this.i++, this.source);
|
4111
|
-
if (shouldYield === errorObj) {
|
4112
|
-
return this.observer.onError(shouldYield.e);
|
4113
|
-
}
|
4114
|
-
shouldYield && this.observer.onNext(x);
|
4115
|
-
};
|
4116
|
-
FilterObserver.prototype.onError = function (e) {
|
4117
|
-
if(!this.isStopped) { this.isStopped = true; this.observer.onError(e); }
|
4118
|
-
};
|
4119
|
-
FilterObserver.prototype.onCompleted = function () {
|
4120
|
-
if(!this.isStopped) { this.isStopped = true; this.observer.onCompleted(); }
|
4121
|
-
};
|
4122
|
-
FilterObserver.prototype.dispose = function() { this.isStopped = true; };
|
4123
|
-
FilterObserver.prototype.fail = function (e) {
|
4124
|
-
if (!this.isStopped) {
|
4125
|
-
this.isStopped = true;
|
4126
|
-
this.observer.onError(e);
|
4127
|
-
return true;
|
4128
|
-
}
|
4129
|
-
return false;
|
4130
|
-
};
|
4131
|
-
|
4132
4325
|
/**
|
4133
4326
|
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
|
4134
4327
|
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
|
@@ -4140,115 +4333,128 @@
|
|
4140
4333
|
new FilterObservable(this, predicate, thisArg);
|
4141
4334
|
};
|
4142
4335
|
|
4143
|
-
|
4144
|
-
|
4145
|
-
*
|
4146
|
-
* @param {Function} function Function with a callback as the last parameter to convert to an Observable sequence.
|
4147
|
-
* @param {Mixed} [context] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
4148
|
-
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
|
4149
|
-
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
|
4150
|
-
*/
|
4151
|
-
Observable.fromCallback = function (func, context, selector) {
|
4152
|
-
return function () {
|
4153
|
-
var len = arguments.length, args = new Array(len)
|
4154
|
-
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
4336
|
+
function createCbObservable(fn, ctx, selector, args) {
|
4337
|
+
var o = new AsyncSubject();
|
4155
4338
|
|
4156
|
-
|
4157
|
-
|
4158
|
-
var len = arguments.length, results = new Array(len);
|
4159
|
-
for(var i = 0; i < len; i++) { results[i] = arguments[i]; }
|
4160
|
-
|
4161
|
-
if (selector) {
|
4162
|
-
try {
|
4163
|
-
results = selector.apply(context, results);
|
4164
|
-
} catch (e) {
|
4165
|
-
return observer.onError(e);
|
4166
|
-
}
|
4339
|
+
args.push(createCbHandler(o, ctx, selector));
|
4340
|
+
fn.apply(ctx, args);
|
4167
4341
|
|
4168
|
-
|
4169
|
-
|
4170
|
-
if (results.length <= 1) {
|
4171
|
-
observer.onNext.apply(observer, results);
|
4172
|
-
} else {
|
4173
|
-
observer.onNext(results);
|
4174
|
-
}
|
4175
|
-
}
|
4342
|
+
return o.asObservable();
|
4343
|
+
}
|
4176
4344
|
|
4177
|
-
|
4178
|
-
|
4345
|
+
function createCbHandler(o, ctx, selector) {
|
4346
|
+
return function handler () {
|
4347
|
+
var len = arguments.length, results = new Array(len);
|
4348
|
+
for(var i = 0; i < len; i++) { results[i] = arguments[i]; }
|
4179
4349
|
|
4180
|
-
|
4181
|
-
|
4182
|
-
|
4183
|
-
|
4350
|
+
if (isFunction(selector)) {
|
4351
|
+
results = tryCatch(selector).apply(ctx, results);
|
4352
|
+
if (results === errorObj) { return o.onError(results.e); }
|
4353
|
+
o.onNext(results);
|
4354
|
+
} else {
|
4355
|
+
if (results.length <= 1) {
|
4356
|
+
o.onNext(results[0]);
|
4357
|
+
} else {
|
4358
|
+
o.onNext(results);
|
4359
|
+
}
|
4360
|
+
}
|
4361
|
+
|
4362
|
+
o.onCompleted();
|
4184
4363
|
};
|
4364
|
+
}
|
4185
4365
|
|
4186
|
-
|
4187
|
-
|
4188
|
-
|
4189
|
-
|
4190
|
-
|
4191
|
-
|
4192
|
-
|
4193
|
-
|
4194
|
-
|
4195
|
-
|
4196
|
-
|
4366
|
+
/**
|
4367
|
+
* Converts a callback function to an observable sequence.
|
4368
|
+
*
|
4369
|
+
* @param {Function} fn Function with a callback as the last parameter to convert to an Observable sequence.
|
4370
|
+
* @param {Mixed} [ctx] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
4371
|
+
* @param {Function} [selector] A selector which takes the arguments from the callback to produce a single item to yield on next.
|
4372
|
+
* @returns {Function} A function, when executed with the required parameters minus the callback, produces an Observable sequence with a single value of the arguments to the callback as an array.
|
4373
|
+
*/
|
4374
|
+
Observable.fromCallback = function (fn, ctx, selector) {
|
4375
|
+
return function () {
|
4376
|
+
typeof ctx === 'undefined' && (ctx = this);
|
4197
4377
|
|
4198
|
-
|
4199
|
-
|
4200
|
-
|
4201
|
-
|
4202
|
-
|
4203
|
-
}
|
4378
|
+
var len = arguments.length, args = new Array(len)
|
4379
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
4380
|
+
return createCbObservable(fn, ctx, selector, args);
|
4381
|
+
};
|
4382
|
+
};
|
4204
4383
|
|
4205
|
-
|
4206
|
-
|
4384
|
+
function createNodeObservable(fn, ctx, selector, args) {
|
4385
|
+
var o = new AsyncSubject();
|
4207
4386
|
|
4208
|
-
|
4209
|
-
|
4210
|
-
results = selector.apply(context, results);
|
4211
|
-
} catch (e) {
|
4212
|
-
return observer.onError(e);
|
4213
|
-
}
|
4214
|
-
observer.onNext(results);
|
4215
|
-
} else {
|
4216
|
-
if (results.length <= 1) {
|
4217
|
-
observer.onNext.apply(observer, results);
|
4218
|
-
} else {
|
4219
|
-
observer.onNext(results);
|
4220
|
-
}
|
4221
|
-
}
|
4387
|
+
args.push(createNodeHandler(o, ctx, selector));
|
4388
|
+
fn.apply(ctx, args);
|
4222
4389
|
|
4223
|
-
|
4224
|
-
|
4390
|
+
return o.asObservable();
|
4391
|
+
}
|
4225
4392
|
|
4226
|
-
|
4227
|
-
|
4228
|
-
|
4229
|
-
}
|
4230
|
-
};
|
4393
|
+
function createNodeHandler(o, ctx, selector) {
|
4394
|
+
return function handler () {
|
4395
|
+
var err = arguments[0];
|
4396
|
+
if (err) { return o.onError(err); }
|
4231
4397
|
|
4232
|
-
|
4233
|
-
|
4234
|
-
|
4235
|
-
|
4236
|
-
|
4237
|
-
|
4398
|
+
var len = arguments.length, results = [];
|
4399
|
+
for(var i = 1; i < len; i++) { results[i - 1] = arguments[i]; }
|
4400
|
+
|
4401
|
+
if (isFunction(selector)) {
|
4402
|
+
var results = tryCatch(selector).apply(ctx, results);
|
4403
|
+
if (results === errorObj) { return o.onError(results.e); }
|
4404
|
+
o.onNext(results);
|
4405
|
+
} else {
|
4406
|
+
if (results.length <= 1) {
|
4407
|
+
o.onNext(results[0]);
|
4408
|
+
} else {
|
4409
|
+
o.onNext(results);
|
4410
|
+
}
|
4238
4411
|
}
|
4239
|
-
|
4412
|
+
|
4413
|
+
o.onCompleted();
|
4414
|
+
};
|
4415
|
+
}
|
4416
|
+
|
4417
|
+
/**
|
4418
|
+
* Converts a Node.js callback style function to an observable sequence. This must be in function (err, ...) format.
|
4419
|
+
* @param {Function} fn The function to call
|
4420
|
+
* @param {Mixed} [ctx] The context for the func parameter to be executed. If not specified, defaults to undefined.
|
4421
|
+
* @param {Function} [selector] A selector which takes the arguments from the callback minus the error to produce a single item to yield on next.
|
4422
|
+
* @returns {Function} An async function which when applied, returns an observable sequence with the callback arguments as an array.
|
4423
|
+
*/
|
4424
|
+
Observable.fromNodeCallback = function (fn, ctx, selector) {
|
4425
|
+
return function () {
|
4426
|
+
typeof ctx === 'undefined' && (ctx = this);
|
4427
|
+
var len = arguments.length, args = new Array(len);
|
4428
|
+
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
|
4429
|
+
return createNodeObservable(fn, ctx, selector, args);
|
4430
|
+
};
|
4431
|
+
};
|
4432
|
+
|
4433
|
+
function ListenDisposable(e, n, fn) {
|
4434
|
+
this._e = e;
|
4435
|
+
this._n = n;
|
4436
|
+
this._fn = fn;
|
4437
|
+
this._e.addEventListener(this._n, this._fn, false);
|
4438
|
+
this.isDisposed = false;
|
4240
4439
|
}
|
4440
|
+
ListenDisposable.prototype.dispose = function () {
|
4441
|
+
if (!this.isDisposed) {
|
4442
|
+
this._e.removeEventListener(this._n, this._fn, false);
|
4443
|
+
this.isDisposed = true;
|
4444
|
+
}
|
4445
|
+
};
|
4241
4446
|
|
4242
4447
|
function createEventListener (el, eventName, handler) {
|
4243
4448
|
var disposables = new CompositeDisposable();
|
4244
4449
|
|
4245
|
-
// Asume NodeList
|
4246
|
-
|
4450
|
+
// Asume NodeList or HTMLCollection
|
4451
|
+
var elemToString = Object.prototype.toString.call(el);
|
4452
|
+
if (elemToString === '[object NodeList]' || elemToString === '[object HTMLCollection]') {
|
4247
4453
|
for (var i = 0, len = el.length; i < len; i++) {
|
4248
4454
|
disposables.add(createEventListener(el.item(i), eventName, handler));
|
4249
4455
|
}
|
4250
4456
|
} else if (el) {
|
4251
|
-
disposables.add(
|
4457
|
+
disposables.add(new ListenDisposable(el, eventName, handler));
|
4252
4458
|
}
|
4253
4459
|
|
4254
4460
|
return disposables;
|
@@ -4259,12 +4465,19 @@
|
|
4259
4465
|
*/
|
4260
4466
|
Rx.config.useNativeEvents = false;
|
4261
4467
|
|
4468
|
+
function eventHandler(o, selector) {
|
4469
|
+
return function handler () {
|
4470
|
+
var results = arguments[0];
|
4471
|
+
if (isFunction(selector)) {
|
4472
|
+
results = tryCatch(selector).apply(null, arguments);
|
4473
|
+
if (results === errorObj) { return o.onError(results.e); }
|
4474
|
+
}
|
4475
|
+
o.onNext(results);
|
4476
|
+
};
|
4477
|
+
}
|
4478
|
+
|
4262
4479
|
/**
|
4263
4480
|
* Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
|
4264
|
-
*
|
4265
|
-
* @example
|
4266
|
-
* var source = Rx.Observable.fromEvent(element, 'mouseup');
|
4267
|
-
*
|
4268
4481
|
* @param {Object} element The DOMElement or NodeList to attach a listener.
|
4269
4482
|
* @param {String} eventName The event name to attach the observable sequence.
|
4270
4483
|
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
|
@@ -4289,23 +4502,12 @@
|
|
4289
4502
|
selector);
|
4290
4503
|
}
|
4291
4504
|
}
|
4292
|
-
|
4505
|
+
|
4506
|
+
return new AnonymousObservable(function (o) {
|
4293
4507
|
return createEventListener(
|
4294
4508
|
element,
|
4295
4509
|
eventName,
|
4296
|
-
|
4297
|
-
var results = e;
|
4298
|
-
|
4299
|
-
if (selector) {
|
4300
|
-
try {
|
4301
|
-
results = selector(arguments);
|
4302
|
-
} catch (err) {
|
4303
|
-
return observer.onError(err);
|
4304
|
-
}
|
4305
|
-
}
|
4306
|
-
|
4307
|
-
observer.onNext(results);
|
4308
|
-
});
|
4510
|
+
eventHandler(o, selector));
|
4309
4511
|
}).publish().refCount();
|
4310
4512
|
};
|
4311
4513
|
|
@@ -4314,51 +4516,54 @@
|
|
4314
4516
|
* @param {Function} addHandler The function to add a handler to the emitter.
|
4315
4517
|
* @param {Function} [removeHandler] The optional function to remove a handler from an emitter.
|
4316
4518
|
* @param {Function} [selector] A selector which takes the arguments from the event handler to produce a single item to yield on next.
|
4519
|
+
* @param {Scheduler} [scheduler] A scheduler used to schedule the remove handler.
|
4317
4520
|
* @returns {Observable} An observable sequence which wraps an event from an event emitter
|
4318
4521
|
*/
|
4319
|
-
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector) {
|
4320
|
-
|
4321
|
-
|
4322
|
-
|
4323
|
-
|
4324
|
-
|
4325
|
-
|
4326
|
-
|
4327
|
-
return observer.onError(err);
|
4328
|
-
}
|
4522
|
+
var fromEventPattern = Observable.fromEventPattern = function (addHandler, removeHandler, selector, scheduler) {
|
4523
|
+
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
4524
|
+
return new AnonymousObservable(function (o) {
|
4525
|
+
function innerHandler () {
|
4526
|
+
var result = arguments[0];
|
4527
|
+
if (isFunction(selector)) {
|
4528
|
+
result = tryCatch(selector).apply(null, arguments);
|
4529
|
+
if (result === errorObj) { return o.onError(result.e); }
|
4329
4530
|
}
|
4330
|
-
|
4531
|
+
o.onNext(result);
|
4331
4532
|
}
|
4332
4533
|
|
4333
4534
|
var returnValue = addHandler(innerHandler);
|
4334
4535
|
return disposableCreate(function () {
|
4335
|
-
|
4336
|
-
removeHandler(innerHandler, returnValue);
|
4337
|
-
}
|
4536
|
+
isFunction(removeHandler) && removeHandler(innerHandler, returnValue);
|
4338
4537
|
});
|
4339
4538
|
}).publish().refCount();
|
4340
4539
|
};
|
4341
4540
|
|
4342
|
-
|
4343
|
-
|
4344
|
-
|
4345
|
-
|
4346
|
-
|
4347
|
-
|
4348
|
-
return observableDefer(function () {
|
4349
|
-
var subject = new Rx.AsyncSubject();
|
4541
|
+
var FromPromiseObservable = (function(__super__) {
|
4542
|
+
inherits(FromPromiseObservable, __super__);
|
4543
|
+
function FromPromiseObservable(p) {
|
4544
|
+
this.p = p;
|
4545
|
+
__super__.call(this);
|
4546
|
+
}
|
4350
4547
|
|
4351
|
-
|
4352
|
-
|
4353
|
-
|
4354
|
-
|
4355
|
-
|
4356
|
-
|
4548
|
+
FromPromiseObservable.prototype.subscribeCore = function(o) {
|
4549
|
+
this.p.then(function (data) {
|
4550
|
+
o.onNext(data);
|
4551
|
+
o.onCompleted();
|
4552
|
+
}, function (err) { o.onError(err); });
|
4553
|
+
return disposableEmpty;
|
4554
|
+
};
|
4357
4555
|
|
4358
|
-
|
4359
|
-
|
4360
|
-
};
|
4556
|
+
return FromPromiseObservable;
|
4557
|
+
}(ObservableBase));
|
4361
4558
|
|
4559
|
+
/**
|
4560
|
+
* Converts a Promise to an Observable sequence
|
4561
|
+
* @param {Promise} An ES6 Compliant promise.
|
4562
|
+
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
|
4563
|
+
*/
|
4564
|
+
var observableFromPromise = Observable.fromPromise = function (promise) {
|
4565
|
+
return new FromPromiseObservable(promise);
|
4566
|
+
};
|
4362
4567
|
/*
|
4363
4568
|
* Converts an existing observable sequence to an ES6 Compatible Promise
|
4364
4569
|
* @example
|
@@ -4650,7 +4855,7 @@
|
|
4650
4855
|
var observableTimer = Observable.timer = function (dueTime, periodOrScheduler, scheduler) {
|
4651
4856
|
var period;
|
4652
4857
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
4653
|
-
if (periodOrScheduler
|
4858
|
+
if (periodOrScheduler != null && typeof periodOrScheduler === 'number') {
|
4654
4859
|
period = periodOrScheduler;
|
4655
4860
|
} else if (isScheduler(periodOrScheduler)) {
|
4656
4861
|
scheduler = periodOrScheduler;
|
@@ -4659,8 +4864,7 @@
|
|
4659
4864
|
return observableTimerDate(dueTime.getTime(), scheduler);
|
4660
4865
|
}
|
4661
4866
|
if (dueTime instanceof Date && period !== undefined) {
|
4662
|
-
|
4663
|
-
return observableTimerDateAndPeriod(dueTime.getTime(), period, scheduler);
|
4867
|
+
return observableTimerDateAndPeriod(dueTime.getTime(), periodOrScheduler, scheduler);
|
4664
4868
|
}
|
4665
4869
|
return period === undefined ?
|
4666
4870
|
observableTimerTimeSpan(dueTime, scheduler) :
|
@@ -4764,7 +4968,7 @@
|
|
4764
4968
|
* @param {Scheduler} [scheduler] Scheduler to run the debounce timers on. If not specified, the timeout scheduler is used.
|
4765
4969
|
* @returns {Observable} The debounced sequence.
|
4766
4970
|
*/
|
4767
|
-
observableProto.debounce =
|
4971
|
+
observableProto.debounce = function (dueTime, scheduler) {
|
4768
4972
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
4769
4973
|
var source = this;
|
4770
4974
|
return new AnonymousObservable(function (observer) {
|
@@ -4825,25 +5029,33 @@
|
|
4825
5029
|
};
|
4826
5030
|
|
4827
5031
|
function sampleObservable(source, sampler) {
|
4828
|
-
return new AnonymousObservable(function (
|
4829
|
-
var atEnd, value, hasValue;
|
5032
|
+
return new AnonymousObservable(function (o) {
|
5033
|
+
var atEnd = false, value, hasValue = false;
|
4830
5034
|
|
4831
5035
|
function sampleSubscribe() {
|
4832
5036
|
if (hasValue) {
|
4833
5037
|
hasValue = false;
|
4834
|
-
|
5038
|
+
o.onNext(value);
|
4835
5039
|
}
|
4836
|
-
atEnd &&
|
5040
|
+
atEnd && o.onCompleted();
|
4837
5041
|
}
|
4838
5042
|
|
4839
|
-
|
4840
|
-
|
5043
|
+
var sourceSubscription = new SingleAssignmentDisposable();
|
5044
|
+
sourceSubscription.setDisposable(source.subscribe(
|
5045
|
+
function (newValue) {
|
4841
5046
|
hasValue = true;
|
4842
5047
|
value = newValue;
|
4843
|
-
},
|
5048
|
+
},
|
5049
|
+
function (e) { o.onError(e); },
|
5050
|
+
function () {
|
4844
5051
|
atEnd = true;
|
4845
|
-
|
4846
|
-
|
5052
|
+
sourceSubscription.dispose();
|
5053
|
+
}
|
5054
|
+
));
|
5055
|
+
|
5056
|
+
return new CompositeDisposable(
|
5057
|
+
sourceSubscription,
|
5058
|
+
sampler.subscribe(sampleSubscribe, function (e) { o.onError(e); }, sampleSubscribe)
|
4847
5059
|
);
|
4848
5060
|
}, source);
|
4849
5061
|
}
|
@@ -5016,26 +5228,15 @@
|
|
5016
5228
|
err;
|
5017
5229
|
|
5018
5230
|
function next(x, i) {
|
5019
|
-
values[i] = x
|
5020
|
-
var res;
|
5231
|
+
values[i] = x;
|
5021
5232
|
hasValue[i] = true;
|
5022
5233
|
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
|
5023
|
-
if (err) {
|
5024
|
-
|
5025
|
-
|
5026
|
-
}
|
5027
|
-
|
5028
|
-
try {
|
5029
|
-
res = resultSelector.apply(null, values);
|
5030
|
-
} catch (ex) {
|
5031
|
-
o.onError(ex);
|
5032
|
-
return;
|
5033
|
-
}
|
5234
|
+
if (err) { return o.onError(err); }
|
5235
|
+
var res = tryCatch(resultSelector).apply(null, values);
|
5236
|
+
if (res === errorObj) { return o.onError(res.e); }
|
5034
5237
|
o.onNext(res);
|
5035
5238
|
}
|
5036
|
-
|
5037
|
-
o.onCompleted();
|
5038
|
-
}
|
5239
|
+
isDone && values[1] && o.onCompleted();
|
5039
5240
|
}
|
5040
5241
|
|
5041
5242
|
return new CompositeDisposable(
|
@@ -5074,10 +5275,12 @@
|
|
5074
5275
|
function subscribe(o) {
|
5075
5276
|
var q = [], previousShouldFire;
|
5076
5277
|
|
5278
|
+
function drainQueue() { while (q.length > 0) { o.onNext(q.shift()); } }
|
5279
|
+
|
5077
5280
|
var subscription =
|
5078
5281
|
combineLatestSource(
|
5079
5282
|
this.source,
|
5080
|
-
this.pauser.
|
5283
|
+
this.pauser.startWith(false).distinctUntilChanged(),
|
5081
5284
|
function (data, shouldFire) {
|
5082
5285
|
return { data: data, shouldFire: shouldFire };
|
5083
5286
|
})
|
@@ -5086,11 +5289,7 @@
|
|
5086
5289
|
if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
|
5087
5290
|
previousShouldFire = results.shouldFire;
|
5088
5291
|
// change in shouldFire
|
5089
|
-
if (results.shouldFire) {
|
5090
|
-
while (q.length > 0) {
|
5091
|
-
o.onNext(q.shift());
|
5092
|
-
}
|
5093
|
-
}
|
5292
|
+
if (results.shouldFire) { drainQueue(); }
|
5094
5293
|
} else {
|
5095
5294
|
previousShouldFire = results.shouldFire;
|
5096
5295
|
// new data
|
@@ -5102,17 +5301,11 @@
|
|
5102
5301
|
}
|
5103
5302
|
},
|
5104
5303
|
function (err) {
|
5105
|
-
|
5106
|
-
while (q.length > 0) {
|
5107
|
-
o.onNext(q.shift());
|
5108
|
-
}
|
5304
|
+
drainQueue();
|
5109
5305
|
o.onError(err);
|
5110
5306
|
},
|
5111
5307
|
function () {
|
5112
|
-
|
5113
|
-
while (q.length > 0) {
|
5114
|
-
o.onNext(q.shift());
|
5115
|
-
}
|
5308
|
+
drainQueue();
|
5116
5309
|
o.onCompleted();
|
5117
5310
|
}
|
5118
5311
|
);
|
@@ -5157,144 +5350,147 @@
|
|
5157
5350
|
return new PausableBufferedObservable(this, subject);
|
5158
5351
|
};
|
5159
5352
|
|
5160
|
-
|
5161
|
-
|
5162
|
-
inherits(ControlledObservable, __super__);
|
5353
|
+
var ControlledObservable = (function (__super__) {
|
5163
5354
|
|
5164
|
-
|
5165
|
-
return this.source.subscribe(observer);
|
5166
|
-
}
|
5167
|
-
|
5168
|
-
function ControlledObservable (source, enableQueue, scheduler) {
|
5169
|
-
__super__.call(this, subscribe, source);
|
5170
|
-
this.subject = new ControlledSubject(enableQueue, scheduler);
|
5171
|
-
this.source = source.multicast(this.subject).refCount();
|
5172
|
-
}
|
5355
|
+
inherits(ControlledObservable, __super__);
|
5173
5356
|
|
5174
|
-
|
5175
|
-
|
5176
|
-
|
5357
|
+
function subscribe (observer) {
|
5358
|
+
return this.source.subscribe(observer);
|
5359
|
+
}
|
5177
5360
|
|
5178
|
-
|
5361
|
+
function ControlledObservable (source, enableQueue, scheduler) {
|
5362
|
+
__super__.call(this, subscribe, source);
|
5363
|
+
this.subject = new ControlledSubject(enableQueue, scheduler);
|
5364
|
+
this.source = source.multicast(this.subject).refCount();
|
5365
|
+
}
|
5179
5366
|
|
5180
|
-
|
5367
|
+
ControlledObservable.prototype.request = function (numberOfItems) {
|
5368
|
+
return this.subject.request(numberOfItems == null ? -1 : numberOfItems);
|
5369
|
+
};
|
5181
5370
|
|
5182
|
-
|
5371
|
+
return ControlledObservable;
|
5183
5372
|
|
5184
|
-
|
5185
|
-
return this.subject.subscribe(observer);
|
5186
|
-
}
|
5373
|
+
}(Observable));
|
5187
5374
|
|
5188
|
-
|
5375
|
+
var ControlledSubject = (function (__super__) {
|
5189
5376
|
|
5190
|
-
|
5191
|
-
|
5377
|
+
function subscribe (observer) {
|
5378
|
+
return this.subject.subscribe(observer);
|
5379
|
+
}
|
5192
5380
|
|
5193
|
-
|
5194
|
-
|
5195
|
-
|
5196
|
-
|
5197
|
-
|
5198
|
-
|
5199
|
-
|
5200
|
-
|
5201
|
-
|
5202
|
-
|
5203
|
-
|
5381
|
+
inherits(ControlledSubject, __super__);
|
5382
|
+
|
5383
|
+
function ControlledSubject(enableQueue, scheduler) {
|
5384
|
+
enableQueue == null && (enableQueue = true);
|
5385
|
+
|
5386
|
+
__super__.call(this, subscribe);
|
5387
|
+
this.subject = new Subject();
|
5388
|
+
this.enableQueue = enableQueue;
|
5389
|
+
this.queue = enableQueue ? [] : null;
|
5390
|
+
this.requestedCount = 0;
|
5391
|
+
this.requestedDisposable = null;
|
5392
|
+
this.error = null;
|
5393
|
+
this.hasFailed = false;
|
5394
|
+
this.hasCompleted = false;
|
5395
|
+
this.scheduler = scheduler || currentThreadScheduler;
|
5396
|
+
}
|
5204
5397
|
|
5205
|
-
|
5206
|
-
|
5207
|
-
|
5208
|
-
|
5209
|
-
|
5210
|
-
|
5211
|
-
|
5212
|
-
|
5213
|
-
}
|
5214
|
-
|
5215
|
-
|
5216
|
-
|
5217
|
-
|
5218
|
-
|
5219
|
-
|
5220
|
-
|
5398
|
+
addProperties(ControlledSubject.prototype, Observer, {
|
5399
|
+
onCompleted: function () {
|
5400
|
+
this.hasCompleted = true;
|
5401
|
+
if (!this.enableQueue || this.queue.length === 0) {
|
5402
|
+
this.subject.onCompleted();
|
5403
|
+
this.disposeCurrentRequest()
|
5404
|
+
} else {
|
5405
|
+
this.queue.push(Notification.createOnCompleted());
|
5406
|
+
}
|
5407
|
+
},
|
5408
|
+
onError: function (error) {
|
5409
|
+
this.hasFailed = true;
|
5410
|
+
this.error = error;
|
5411
|
+
if (!this.enableQueue || this.queue.length === 0) {
|
5412
|
+
this.subject.onError(error);
|
5413
|
+
this.disposeCurrentRequest()
|
5414
|
+
} else {
|
5415
|
+
this.queue.push(Notification.createOnError(error));
|
5416
|
+
}
|
5417
|
+
},
|
5418
|
+
onNext: function (value) {
|
5419
|
+
if (this.requestedCount <= 0) {
|
5420
|
+
this.enableQueue && this.queue.push(Notification.createOnNext(value));
|
5421
|
+
} else {
|
5422
|
+
(this.requestedCount-- === 0) && this.disposeCurrentRequest();
|
5423
|
+
this.subject.onNext(value);
|
5424
|
+
}
|
5425
|
+
},
|
5426
|
+
_processRequest: function (numberOfItems) {
|
5427
|
+
if (this.enableQueue) {
|
5428
|
+
while (this.queue.length > 0 && (numberOfItems > 0 || this.queue[0].kind !== 'N')) {
|
5429
|
+
var first = this.queue.shift();
|
5430
|
+
first.accept(this.subject);
|
5431
|
+
if (first.kind === 'N') {
|
5432
|
+
numberOfItems--;
|
5433
|
+
} else {
|
5434
|
+
this.disposeCurrentRequest();
|
5435
|
+
this.queue = [];
|
5436
|
+
}
|
5221
5437
|
}
|
5222
|
-
}
|
5223
|
-
onNext: function (value) {
|
5224
|
-
var hasRequested = false;
|
5438
|
+
}
|
5225
5439
|
|
5226
|
-
|
5227
|
-
|
5228
|
-
|
5229
|
-
|
5230
|
-
|
5231
|
-
}
|
5232
|
-
hasRequested && this.subject.onNext(value);
|
5233
|
-
},
|
5234
|
-
_processRequest: function (numberOfItems) {
|
5235
|
-
if (this.enableQueue) {
|
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
|
-
}
|
5246
|
-
}
|
5440
|
+
return numberOfItems;
|
5441
|
+
},
|
5442
|
+
request: function (number) {
|
5443
|
+
this.disposeCurrentRequest();
|
5444
|
+
var self = this;
|
5247
5445
|
|
5248
|
-
|
5249
|
-
|
5446
|
+
this.requestedDisposable = this.scheduler.scheduleWithState(number,
|
5447
|
+
function(s, i) {
|
5448
|
+
var remaining = self._processRequest(i);
|
5449
|
+
var stopped = self.hasCompleted || self.hasFailed
|
5450
|
+
if (!stopped && remaining > 0) {
|
5451
|
+
self.requestedCount = remaining;
|
5250
5452
|
|
5251
|
-
|
5252
|
-
|
5253
|
-
|
5254
|
-
|
5255
|
-
|
5256
|
-
|
5257
|
-
|
5258
|
-
|
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
|
-
});
|
5453
|
+
return disposableCreate(function () {
|
5454
|
+
self.requestedCount = 0;
|
5455
|
+
});
|
5456
|
+
// Scheduled item is still in progress. Return a new
|
5457
|
+
// disposable to allow the request to be interrupted
|
5458
|
+
// via dispose.
|
5459
|
+
}
|
5460
|
+
});
|
5267
5461
|
|
5268
|
-
|
5269
|
-
|
5270
|
-
|
5462
|
+
return this.requestedDisposable;
|
5463
|
+
},
|
5464
|
+
disposeCurrentRequest: function () {
|
5465
|
+
if (this.requestedDisposable) {
|
5271
5466
|
this.requestedDisposable.dispose();
|
5272
|
-
this.requestedDisposable =
|
5467
|
+
this.requestedDisposable = null;
|
5273
5468
|
}
|
5274
|
-
});
|
5275
|
-
|
5276
|
-
return ControlledSubject;
|
5277
|
-
}(Observable));
|
5278
|
-
|
5279
|
-
/**
|
5280
|
-
* Attaches a controller to the observable sequence with the ability to queue.
|
5281
|
-
* @example
|
5282
|
-
* var source = Rx.Observable.interval(100).controlled();
|
5283
|
-
* source.request(3); // Reads 3 values
|
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
|
5286
|
-
* @returns {Observable} The observable sequence which is paused based upon the pauser.
|
5287
|
-
*/
|
5288
|
-
observableProto.controlled = function (enableQueue, scheduler) {
|
5289
|
-
|
5290
|
-
if (enableQueue && isScheduler(enableQueue)) {
|
5291
|
-
scheduler = enableQueue;
|
5292
|
-
enableQueue = true;
|
5293
5469
|
}
|
5470
|
+
});
|
5471
|
+
|
5472
|
+
return ControlledSubject;
|
5473
|
+
}(Observable));
|
5474
|
+
|
5475
|
+
/**
|
5476
|
+
* Attaches a controller to the observable sequence with the ability to queue.
|
5477
|
+
* @example
|
5478
|
+
* var source = Rx.Observable.interval(100).controlled();
|
5479
|
+
* source.request(3); // Reads 3 values
|
5480
|
+
* @param {bool} enableQueue truthy value to determine if values should be queued pending the next request
|
5481
|
+
* @param {Scheduler} scheduler determines how the requests will be scheduled
|
5482
|
+
* @returns {Observable} The observable sequence which only propagates values on request.
|
5483
|
+
*/
|
5484
|
+
observableProto.controlled = function (enableQueue, scheduler) {
|
5485
|
+
|
5486
|
+
if (enableQueue && isScheduler(enableQueue)) {
|
5487
|
+
scheduler = enableQueue;
|
5488
|
+
enableQueue = true;
|
5489
|
+
}
|
5294
5490
|
|
5295
|
-
|
5296
|
-
|
5297
|
-
|
5491
|
+
if (enableQueue == null) { enableQueue = true; }
|
5492
|
+
return new ControlledObservable(this, enableQueue, scheduler);
|
5493
|
+
};
|
5298
5494
|
|
5299
5495
|
/**
|
5300
5496
|
* Pipes the existing Observable sequence into a Node.js Stream.
|
@@ -5354,11 +5550,8 @@
|
|
5354
5550
|
var xform = transducer(transformForObserver(o));
|
5355
5551
|
return source.subscribe(
|
5356
5552
|
function(v) {
|
5357
|
-
|
5358
|
-
|
5359
|
-
} catch (e) {
|
5360
|
-
o.onError(e);
|
5361
|
-
}
|
5553
|
+
var res = tryCatch(xform['@@transducer/step']).call(xform, o, v);
|
5554
|
+
if (res === errorObj) { o.onError(res.e); }
|
5362
5555
|
},
|
5363
5556
|
function (e) { o.onError(e); },
|
5364
5557
|
function() { xform['@@transducer/result'](o); }
|
@@ -5376,8 +5569,8 @@
|
|
5376
5569
|
}
|
5377
5570
|
|
5378
5571
|
function setDisposable(s, state) {
|
5379
|
-
var ado = state[0],
|
5380
|
-
var sub = tryCatch(
|
5572
|
+
var ado = state[0], self = state[1];
|
5573
|
+
var sub = tryCatch(self.__subscribe).call(self, ado);
|
5381
5574
|
|
5382
5575
|
if (sub === errorObj) {
|
5383
5576
|
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
|
@@ -5385,21 +5578,21 @@
|
|
5385
5578
|
ado.setDisposable(fixSubscriber(sub));
|
5386
5579
|
}
|
5387
5580
|
|
5388
|
-
function
|
5389
|
-
|
5390
|
-
|
5391
|
-
function s(observer) {
|
5392
|
-
var ado = new AutoDetachObserver(observer), state = [ado, subscribe];
|
5581
|
+
function innerSubscribe(observer) {
|
5582
|
+
var ado = new AutoDetachObserver(observer), state = [ado, this];
|
5393
5583
|
|
5394
|
-
|
5395
|
-
|
5396
|
-
|
5397
|
-
|
5398
|
-
}
|
5399
|
-
return ado;
|
5584
|
+
if (currentThreadScheduler.scheduleRequired()) {
|
5585
|
+
currentThreadScheduler.scheduleWithState(state, setDisposable);
|
5586
|
+
} else {
|
5587
|
+
setDisposable(null, state);
|
5400
5588
|
}
|
5589
|
+
return ado;
|
5590
|
+
}
|
5401
5591
|
|
5402
|
-
|
5592
|
+
function AnonymousObservable(subscribe, parent) {
|
5593
|
+
this.source = parent;
|
5594
|
+
this.__subscribe = subscribe;
|
5595
|
+
__super__.call(this, innerSubscribe);
|
5403
5596
|
}
|
5404
5597
|
|
5405
5598
|
return AnonymousObservable;
|