forked from Reactive-Extensions/RxJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rx.experimental.min.js
1 lines (1 loc) · 2.84 KB
/
rx.experimental.min.js
1
(function(t,e){var n="object"==typeof exports&&exports,r=("object"==typeof module&&module&&module.exports==n&&module,"object"==typeof global&&global);r.global===r&&(window=r),"function"==typeof define&&define.amd?define(["rx","exports"],function(n,r){return t.Rx=e(t,r,n),t.Rx}):"object"==typeof module&&module&&module.exports===n?module.exports=e(t,module.exports,require("./rx")):t.Rx=e(t,{},t.Rx)})(this,function(t,e,n,r){function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:g.call(t)}function o(t,e){return new m(function(){var n;return v(function(){return t()?(n=e,!0):!1},function(){return n})})}var s=n.Observable,u=s.prototype,c=s.createWithDisposable,a=s.concat,h=s.defer,l=s.empty,f=n.Disposable.empty,p=(n.Internals.BinaryObserver,n.CompositeDisposable),d=n.SerialDisposable,b=n.SingleAssignmentDisposable,v=n.Internals.Enumerator.create,m=n.Internals.Enumerable,y=m.forEach,w=n.Scheduler.immediate,g=Array.prototype.slice;u.letBind=function(t){return t(this)},s.ifThen=function(t,e,n){return h(function(){if(n||(n=l()),n.now){var r=n;n=l(r)}return t()?e:n})},s.forIn=function(t,e){return y(t,e).concat()};var E=s.whileDo=function(t,e){return o(t,e).concat()};return u.doWhile=function(t){return a([this,E(t,this)])},s.switchCase=function(t,e,n){return h(function(){if(n||(n=l()),n.now){var i=n;n=l(i)}var o=e[t()];return o!==r?o:n})},u.expand=function(t,e){e||(e=w);var n=this;return c(function(i){var o=[],s=new d,u=new p(s),c=0,a=!1,h=function(){var n=!1;o.length>0&&(n=!a,a=!0),n&&s.setDisposable(e.scheduleRecursive(function(e){var n;if(!(o.length>0))return a=!1,r;n=o.shift();var s=new b;u.add(s),s.setDisposable(n.subscribe(function(e){i.onNext(e);var n=null;try{n=t(e)}catch(r){i.onError(r)}o.push(n),c++,h()},i.onError.bind(i),function(){u.remove(s),c--,0===c&&i.onCompleted()})),e()}))};return o.push(n),c++,h(),u})},s.forkJoin=function(){var t=i(arguments,0);return c(function(e){var n=t.length;if(0===n)return e.onCompleted(),f;for(var i=new p,o=!1,s=Array(n),u=Array(n),c=Array(n),a=0;n>a;a++)(function(a){var h=t[a];i.add(h.subscribe(function(t){o||(s[a]=!0,c[a]=t)},function(t){o=!0,e.onError(t),i.dispose()},function(){if(!o){if(!s[a])return e.onCompleted(),r;u[a]=!0;for(var t=0;n>t;t++)if(!u[t])return;o=!0,e.onNext(c),e.onCompleted()}}))})(a);return i})},u.forkJoin=function(t,e){var n=this;return c(function(i){var o,s,u=!1,c=!1,a=!1,h=!1,l=new b,f=new b;return l.setDisposable(n.subscribe(function(t){a=!0,o=t},function(t){f.dispose(),i.onError(t)},function(){if(u=!0,c)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),f.setDisposable(t.subscribe(function(t){h=!0,s=t},function(t){l.dispose(),i.onError(t)},function(){if(c=!0,u)if(a)if(h){var t;try{t=e(o,s)}catch(n){return i.onError(n),r}i.onNext(t),i.onCompleted()}else i.onCompleted();else i.onCompleted()})),new p(l,f)})},n});