3 lines
9.7 KiB
JavaScript
Executable File
3 lines
9.7 KiB
JavaScript
Executable File
/* 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.core"],function(b,c){return a(j,c,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(j,module.exports,require("./rx.core")):j.Rx=a(j,{},j.Rx)}).call(this,function(a,b,c,d){function e(a){for(var b=a.length,c=new Array(b),d=0;b>d;d++)c[d]=a[d];return c}function f(a){return function(){try{return a.apply(this,arguments)}catch(b){return v.e=b,v}}}function g(a){throw a}var h=c.Observable,i=h.prototype,j=(c.AnonymousObservable,c.ObservableBase),k=c.Observer,l=c.internals.AbstractObserver,m=c.Disposable.create,n=c.Disposable.empty,o=(c.CompositeDisposable,c.BinaryDisposable),p=c.SerialDisposable,q=c.Scheduler.currentThread,r=c.helpers.isFunction,s=c.internals.inherits,t=c.internals.addProperties,u=c.Disposable.checkDisposed,v={e:{}},w=c.internals.tryCatch=function(a){if(!r(a))throw new TypeError("fn must be a function");return f(a)},x=function(a){function b(b,c,d){this.source=b,this._fn1=c,this._fn2=d,a.call(this)}return s(b,a),b.prototype.subscribeCore=function(a){var b=this.source.multicast(this._fn1());return new o(this._fn2(b).subscribe(a),b.connect())},b}(j);i.multicast=function(a,b){return r(a)?new x(this,a,b):new G(this,a)},i.publish=function(a){return a&&r(a)?this.multicast(function(){return new A},a):this.multicast(new A)},i.share=function(){return this.publish().refCount()},i.publishLast=function(a){return a&&r(a)?this.multicast(function(){return new C},a):this.multicast(new C)},i.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new D(b)},a):this.multicast(new D(a))},i.shareValue=function(a){return this.publishValue(a).refCount()},i.replay=function(a,b,c,d){return a&&r(a)?this.multicast(function(){return new E(b,c,d)},a):this.multicast(new E(b,c,d))},i.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var y=c.internals.ScheduledObserver=function(a){function b(b,c){a.call(this),this.scheduler=b,this.observer=c,this.isAcquired=!1,this.hasFaulted=!1,this.queue=[],this.disposable=new p}function c(a,b){return function(){a.onNext(b)}}function d(a,b){return function(){a.onError(b)}}function e(a){return function(){a.onCompleted()}}function f(a,b){var c;if(!(a.queue.length>0))return void(a.isAcquired=!1);c=a.queue.shift();var d=w(c)();return d===v?(a.queue=[],a.hasFaulted=!0,g(d.e)):void b(a)}return s(b,a),b.prototype.next=function(a){this.queue.push(c(this.observer,a))},b.prototype.error=function(a){this.queue.push(d(this.observer,a))},b.prototype.completed=function(){this.queue.push(e(this.observer))},b.prototype.ensureActive=function(){var a=!1;!this.hasFaulted&&this.queue.length>0&&(a=!this.isAcquired,this.isAcquired=!0),a&&this.disposable.setDisposable(this.scheduler.scheduleRecursive(this,f))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(l),z=function(a,b){this._s=a,this._o=b};z.prototype.dispose=function(){if(!this._s.isDisposed&&null!==this._o){var a=this._s.observers.indexOf(this._o);this._s.observers.splice(a,1),this._o=null}};var A=c.Subject=function(a){function b(){a.call(this),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return s(b,a),t(b.prototype,k.prototype,{_subscribe:function(a){return u(this),this.isStopped?this.hasError?(a.onError(this.error),n):(a.onCompleted(),n):(this.observers.push(a),new z(this,a))},hasObservers:function(){return u(this),this.observers.length>0},onCompleted:function(){if(u(this),!this.isStopped){this.isStopped=!0;for(var a=0,b=e(this.observers),c=b.length;c>a;a++)b[a].onCompleted();this.observers.length=0}},onError:function(a){if(u(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;for(var b=0,c=e(this.observers),d=c.length;d>b;b++)c[b].onError(a);this.observers.length=0}},onNext:function(a){if(u(this),!this.isStopped)for(var b=0,c=e(this.observers),d=c.length;d>b;b++)c[b].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),b.create=function(a,b){return new B(a,b)},b}(h),B=c.AnonymousSubject=function(a){function b(b,c){this.observer=b,this.observable=c,a.call(this)}return s(b,a),t(b.prototype,k.prototype,{_subscribe:function(a){return this.observable.subscribe(a)},onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),b}(h),C=c.AsyncSubject=function(a){function b(){a.call(this),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return s(b,a),t(b.prototype,k.prototype,{_subscribe:function(a){return u(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),n):(this.observers.push(a),new z(this,a))},hasObservers:function(){return u(this),this.observers.length>0},onCompleted:function(){var a,b;if(u(this),!this.isStopped){this.isStopped=!0;var c=e(this.observers),b=c.length;if(this.hasValue)for(a=0;b>a;a++){var d=c[a];d.onNext(this.value),d.onCompleted()}else for(a=0;b>a;a++)c[a].onCompleted();this.observers.length=0}},onError:function(a){if(u(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var b=0,c=e(this.observers),d=c.length;d>b;b++)c[b].onError(a);this.observers.length=0}},onNext:function(a){u(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.error=null,this.value=null}}),b}(h),D=c.BehaviorSubject=function(a){function b(b){a.call(this),this.value=b,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return s(b,a),t(b.prototype,k.prototype,{_subscribe:function(a){return u(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),n):(this.observers.push(a),a.onNext(this.value),new z(this,a))},getValue:function(){return u(this),this.hasError&&g(this.error),this.value},hasObservers:function(){return u(this),this.observers.length>0},onCompleted:function(){if(u(this),!this.isStopped){this.isStopped=!0;for(var a=0,b=e(this.observers),c=b.length;c>a;a++)b[a].onCompleted();this.observers.length=0}},onError:function(a){if(u(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var b=0,c=e(this.observers),d=c.length;d>b;b++)c[b].onError(a);this.observers.length=0}},onNext:function(a){if(u(this),!this.isStopped){this.value=a;for(var b=0,c=e(this.observers),d=c.length;d>b;b++)c[b].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.error=null}}),b}(h),E=c.ReplaySubject=function(a){function b(a,b){return m(function(){b.dispose(),!a.isDisposed&&a.observers.splice(a.observers.indexOf(b),1)})}function c(b,c,e){this.bufferSize=null==b?d:b,this.windowSize=null==c?d:c,this.scheduler=e||q,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this)}var d=Math.pow(2,53)-1;return s(c,a),t(c.prototype,k.prototype,{_subscribe:function(a){u(this);var c=new y(this.scheduler,a),d=b(this,c);this._trim(this.scheduler.now()),this.observers.push(c);for(var e=0,f=this.q.length;f>e;e++)c.onNext(this.q[e].value);return this.hasError?c.onError(this.error):this.isStopped&&c.onCompleted(),c.ensureActive(),d},hasObservers:function(){return u(this),this.observers.length>0},_trim:function(a){for(;this.q.length>this.bufferSize;)this.q.shift();for(;this.q.length>0&&a-this.q[0].interval>this.windowSize;)this.q.shift()},onNext:function(a){if(u(this),!this.isStopped){var b=this.scheduler.now();this.q.push({interval:b,value:a}),this._trim(b);for(var c=0,d=e(this.observers),f=d.length;f>c;c++){var g=d[c];g.onNext(a),g.ensureActive()}}},onError:function(a){if(u(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var b=this.scheduler.now();this._trim(b);for(var c=0,d=e(this.observers),f=d.length;f>c;c++){var g=d[c];g.onError(a),g.ensureActive()}this.observers.length=0}},onCompleted:function(){if(u(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var b=0,c=e(this.observers),d=c.length;d>b;b++){var f=c[b];f.onCompleted(),f.ensureActive()}this.observers.length=0}},dispose:function(){this.isDisposed=!0,this.observers=null}}),c}(h),F=function(a){function b(b){this.source=b,this._count=0,this._connectableSubscription=null,a.call(this)}function c(a,b){this._p=a,this._s=b,this.isDisposed=!1}return s(b,a),b.prototype.subscribeCore=function(a){var b=this.source.subscribe(a);return 1===++this._count&&(this._connectableSubscription=this.source.connect()),new c(this,b)},c.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this._s.dispose(),0===--this._p._count&&this._p._connectableSubscription.dispose())},b}(j),G=c.ConnectableObservable=function(a){function b(b,c){this.source=b,this._connection=null,this._source=b.asObservable(),this._subject=c,a.call(this)}function c(a,b){this._p=a,this._s=b}return s(b,a),c.prototype.dispose=function(){this._s&&(this._s.dispose(),this._s=null,this._p._connection=null)},b.prototype.connect=function(){if(!this._connection){if(this._subject.isStopped)return n;var a=this._source.subscribe(this._subject);this._connection=new c(this,a)}return this._connection},b.prototype._subscribe=function(a){return this._subject.subscribe(a)},b.prototype.refCount=function(){return new F(this)},b}(h);return c});
|
|
//# sourceMappingURL=rx.core.binding.map
|