3 lines
7.7 KiB
JavaScript
3 lines
7.7 KiB
JavaScript
|
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
|
||
|
(function(a){function b(a){return a&&a.Object===Object?a:null}var c={"function":!0,object:!0},d=c[typeof exports]&&exports&&!exports.nodeType?exports:null,e=c[typeof module]&&module&&!module.nodeType?module:null,f=b(d&&e&&"object"==typeof global&&global),g=b(c[typeof self]&&self),h=b(c[typeof window]&&window),i=(e&&e.exports===d?d:null,b(c[typeof this]&&this)),j=f||h!==(i&&i.window)&&h||g||i||Function("return this")();"function"==typeof define&&define.amd?define(["./rx"],function(b,c){return a(j,c,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(j,module.exports,require("./rx")):j.Rx=a(j,{},j.Rx)}).call(this,function(a,b,c,d){function e(a){return function(){try{return a.apply(this,arguments)}catch(b){return y.e=b,y}}}function f(a,b,c){return new i(function(d){function e(a,b){if(j[b]=a,g[b]=!0,h||(h=g.every(v))){if(f)return d.onError(f);var e=z(c).apply(null,j);if(e===y)return d.onError(e.e);d.onNext(e)}i&&j[1]&&d.onCompleted()}var f,g=[!1,!1],h=!1,i=!1,j=new Array(2);return new k(a.subscribe(function(a){e(a,0)},function(a){j[1]?d.onError(a):f=a},function(){i=!0,j[1]&&d.onCompleted()}),b.subscribe(function(a){e(a,1)},function(a){d.onError(a)},function(){i=!0,e(!0,1)}))},a)}var g=c.Observable,h=g.prototype,i=c.AnonymousObservable,j=c.internals.AbstractObserver,k=(c.CompositeDisposable,c.BinaryDisposable),l=c.NAryDisposable,m=c.Notification,n=c.Subject,o=c.Observer,p=c.Disposable.empty,q=c.Disposable.create,r=c.internals.inherits,s=c.internals.addProperties,t=c.Scheduler["default"],u=c.Scheduler.currentThread,v=c.helpers.identity,w=c.Scheduler.isScheduler,x=c.helpers.isFunction,y=(c.Disposable.checkDisposed,{e:{}}),z=c.internals.tryCatch=function(a){if(!x(a))throw new TypeError("fn must be a function");return e(a)};c.Pauser=function(a){function b(){a.call(this)}return r(b,a),b.prototype.pause=function(){this.onNext(!1)},b.prototype.resume=function(){this.onNext(!0)},b}(n);var A=function(a){function b(b,c){this.source=b,this.controller=new n,this.paused=!0,c&&c.subscribe?this.pauser=this.controller.merge(c):this.pauser=this.controller,a.call(this)}return r(b,a),b.prototype._subscribe=function(a){var b=this.source.publish(),c=b.subscribe(a),d=p,e=this.pauser.startWith(!this.paused).distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=p)});return new l([c,d,e])},b.prototype.pause=function(){this.paused=!0,this.controller.onNext(!1)},b.prototype.resume=function(){this.paused=!1,this.controller.onNext(!0)},b}(g);h.pausable=function(a){return new A(this,a)};var B=function(a){function b(b,c){this.source=b,this.controller=new n,this.paused=!0,c&&c.subscribe?this.pauser=this.controller.merge(c):this.pauser=this.controller,a.call(this)}return r(b,a),b.prototype._subscribe=function(a){function b(){for(;e.length>0;)a.onNext(e.shift())}var c,e=[],g=f(this.source,this.pauser.startWith(!this.paused).distinctUntilChanged(),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(f){c!==d&&f.shouldFire!==c?(c=f.shouldFire,f.shouldFire&&b()):(c=f.shouldFire,f.shouldFire?a.onNext(f.data):e.push(f.data))},function(c){b(),a.onError(c)},function(){b(),a.onCompleted()});return g},b.prototype.pause=function(){this.paused=!0,this.controller.onNext(!1)},b.prototype.resume=function(){this.paused=!1,this.controller.onNext(!0)},b}(g);h.pausableBuffered=function(a){return new B(this,a)};var C=function(a){function b(b,c,d){a.call(this),this.subject=new D(c,d),this.source=b.multicast(this.subject).refCount()}return r(b,a),b.prototype._subscribe=function(a){return this.source.subscribe(a)},b.prototype.request=function(a){return this.subject.request(null==a?-1:a)},b}(g),D=function(a){function b(b,c){null==b&&(b=!0),a.call(this),this.subject=new n,this.enableQueue=b,this.queue=b?[]:null,this.requestedCount=0,this.requestedDisposable=null,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.scheduler=c||u}return r(b,a),s(b.prototype,o,{_subscribe:function(a){return this.subject.subscribe(a)},onCompleted:function(){this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length?this.queue.push(m.create
|
||
|
//# sourceMappingURL=rx.backpressure.map
|