forked from Reactive-Extensions/RxJS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrx.async.min.js
More file actions
1 lines (1 loc) · 2.44 KB
/
Copy pathrx.async.min.js
File metadata and controls
1 lines (1 loc) · 2.44 KB
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){function r(t,e,n){return t.addListener?(t.addListener(e,n),c(function(){t.removeListener(e,n)})):t.addEventListener?(t.addEventListener(e,n,!1),c(function(){t.removeEventListener(e,n,!1)})):undefined}function i(t,e,n){var o=new a;if(t&&t.length)for(var s=0,u=t.length;u>s;s++)o.add(i(t[s],e,n));else t&&o.add(r(t,e,n));return o}var o=n.Observable,s=n.Internals.AnonymousObservable,u=n.AsyncSubject,c=n.Disposable.create,a=n.CompositeDisposable,u=n.AsyncSubject;timeoutScheduler=n.Scheduler.timeout,slice=Array.prototype.slice,o.start=function(t,e,n){return l(t,e,n)()};var l=o.toAsync=function(t,e,n){return e||(e=timeoutScheduler),function(){var r=arguments,i=new u;return e.schedule(function(){var e;try{e=t.apply(n,r)}catch(o){return i.onError(o),undefined}i.onNext(e),i.onCompleted()}),i.asObservable()}};return o.fromCallback=function(t,e,n,r){return e||(e=timeoutScheduler),function(){var i=slice.call(arguments,0),o=new u;return e.schedule(function(){function e(t){var e=t;if(r)try{e=r(arguments)}catch(n){return o.onError(n),undefined}else 1===e.length&&(e=e[0]);o.onNext(e),o.onCompleted()}i.push(e),t.apply(n,i)}),o.asObservable()}},o.fromNodeCallback=function(t,e,n,r){return e||(e=timeoutScheduler),function(){var i=slice.call(arguments,0),o=new u;return e.schedule(function(){function e(t){if(t)return o.onError(t),undefined;var e=slice.call(arguments,1);if(r)try{e=r(e)}catch(n){return o.onError(n),undefined}else 1===e.length&&(e=e[0]);o.onNext(e),o.onCompleted()}i.push(e),t.apply(n,i)}),o.asObservable()}},o.fromEvent=function(t,e,n){return new s(function(r){return i(t,e,function(t){var e=t;if(n)try{e=n(arguments)}catch(i){return r.onError(i),undefined}r.onNext(e)})}).publish().refCount()},o.fromEventPattern=function(t,e,n){return new s(function(r){function i(t){var e=t;if(n)try{e=n(arguments)}catch(i){return r.onError(i),undefined}r.onNext(e)}var o=t(i);return c(function(){e&&e(i,o)})}).publish().refCount()},o.fromPromise=function(t){var e=new u;return t.then(function(t){e.onNext(t),e.onCompleted()},function(t){e.onError(t)}),e.asObservable()},n});