forked from Reactive-Extensions/RxJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrx.experimental.min.js
1 lines (1 loc) · 3.84 KB
/
rx.experimental.min.js
1
(function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,i=e[typeof module]&&module&&!module.nodeType&&module,o=(i&&i.exports===r&&r,e[typeof global]&&global);!o||o.global!==o&&o.window!==o||(n=o),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n,r){function i(){}function o(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:E.call(t)}function s(t,e){return new y(function(){var n;return m(function(){return t()?(n=e,!0):!1},function(){return n})})}var u=n.Observable,c=u.prototype,a=n.Internals.AnonymousObservable,f=u.concat,h=u.defer,l=u.empty,p=n.Disposable.empty,d=(n.Internals.BinaryObserver,n.CompositeDisposable),b=n.SerialDisposable,v=n.SingleAssignmentDisposable,m=n.Internals.Enumerator.create,y=n.Internals.Enumerable,w=y.forEach,g=n.Scheduler.immediate,x=n.Scheduler.currentThread,E=Array.prototype.slice,C=n.AsyncSubject,D=n.Observer,N=n.Internals.inherits,A=n.Internals.addProperties;c.letBind=c.let=function(t){return t(this)},u["if"]=u.ifThen=function(t,e,n){return h(function(){if(n||(n=l()),n.now){var r=n;n=l(r)}return t()?e:n})},u["for"]=u.forIn=function(t,e){return w(t,e).concat()};var S=u["while"]=u.whileDo=function(t,e){return s(t,e).concat()};c.doWhile=function(t){return f([this,S(t,this)])},u["case"]=u.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})},c.expand=function(t,e){e||(e=g);var n=this;return new a(function(i){var o=[],s=new b,u=new d(s),c=0,a=!1,f=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 v;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++,f()},i.onError.bind(i),function(){u.remove(s),c--,0===c&&i.onCompleted()})),e()}))};return o.push(n),c++,f(),u})},u.forkJoin=function(){var t=o(arguments,0);return new a(function(e){var n=t.length;if(0===n)return e.onCompleted(),p;for(var i=new d,o=!1,s=Array(n),u=Array(n),c=Array(n),a=0;n>a;a++)(function(a){var f=t[a];i.add(f.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})},c.forkJoin=function(t,e){var n=this;return new a(function(i){var o,s,u=!1,c=!1,a=!1,f=!1,h=new v,l=new v;return h.setDisposable(n.subscribe(function(t){a=!0,o=t},function(t){l.dispose(),i.onError(t)},function(){if(u=!0,c)if(a)if(f){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()})),l.setDisposable(t.subscribe(function(t){f=!0,s=t},function(t){h.dispose(),i.onError(t)},function(){if(c=!0,u)if(a)if(f){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 d(h,l)})},c.manySelect=function(t,e){e||(e=g);var n=this;return h(function(){var r;return n.select(function(t){var e=new _(t);return r&&r.onNext(t),r=e,e}).doAction(i,function(t){r&&r.onError(t)},function(){r&&r.onCompleted()}).observeOn(e).select(function(e,n,r){return t(e,n,r)})})};var _=function(t){function e(t){var e=this,n=new d;return n.add(x.schedule(function(){t.onNext(e.head),n.add(e.tail.mergeObservable().subscribe(t))})),n}function n(n){t.call(this,e),this.head=n,this.tail=new C}return N(n,t),A(n.prototype,D,{onCompleted:function(){this.onNext(u.empty())},onError:function(t){this.onNext(u.throwException(t))},onNext:function(t){this.tail.onNext(t),this.tail.onCompleted()}}),n}(u);return n});