Repository navigation
Expand file tree
/
Copy pathrx.lite.extras.min.js
More file actions
1 lines (1 loc) · 6.04 KB
/
Copy pathrx.lite.extras.min.js
File metadata and controls
1 lines (1 loc) · 6.04 KB
1
(function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:C.call(a)}function f(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}var g=c.Observable,h=g.prototype,i=g.never,j=g.throwException,k=c.AnonymousObservable,l=c.Observer,m=c.Subject,n=c.internals,o=c.helpers,p=n.ScheduledObserver,q=c.SingleAssignmentDisposable,r=c.CompositeDisposable,s=c.RefCountDisposable,t=c.Disposable.empty,u=c.Scheduler.immediate,v=o.defaultKeySerializer,w=c.internals.addRef,x=o.identity,y=o.isPromise,z=n.inherits,A=o.noop,B=g.fromPromise,C=Array.prototype.slice,D="Argument out of range";f.prototype.dispose=function(){var a=this;this.scheduler.schedule(function(){a.isDisposed||(a.isDisposed=!0,a.disposable.dispose())})};var E=(function(a){function b(b){a.call(this),this._observer=b,this._state=0}z(b,a);var c=b.prototype;return c. b}finally{this._state=0}},c. b}finally{this._state=2}},c. a}finally{this._state=2}},c.checkAccess=function(){if(1===this._state)throw new Error("Re-entrancy detected");if(2===this._state)throw new Error("Observer completed");0===this._state&&(this._state=1)},b}(l),function(a){function b(){a.apply(this,arguments)}return z(b,a),b.prototype.next=function(b){a.prototype.next.call(this,b),this.ensureActive()},b.prototype.error=function(b){a.prototype.error.call(this,b),this.ensureActive()},b.prototype.completed=function(){a.prototype.completed.call(this),this.ensureActive()},b}(p));h.observeOn=function(a){var b=this;return new k(function(c){return b.subscribe(new E(a,c))})},h.subscribeOn=function(a){var b=this;return new k(function(c){var d=new q,e=new SerialDisposable;return e.setDisposable(d),d.setDisposable(a.schedule(function(){e.setDisposable(new f(a,b.subscribe(c)))})),e})},g.using=function(a,b){return new k(function(c){var d,e,f=t;try{d=a(),d&&(f=d),e=b(d)}catch(g){return new r(j(g).subscribe(c),f)}return new r(e.subscribe(c),f)})},h.amb=function(a){var b=this;return new k(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new q,j=new q;return y(a)&&(a=B(a)),i.setDisposable(b.subscribe(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()})),j.setDisposable(a.subscribe(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()})),new r(i,j)})},g.amb=function(){function a(a,b){return a.amb(b)}for(var b=i(),c=e(arguments,0),d=0,f=c.length;f>d;d++)b=a(b,c[d]);return b},h. new Error("Second observable is required");return F([this,a])};var F=g. a=e(arguments,0);return new k(function(b){var c=0,d=new SerialDisposable,e=u.scheduleRecursive(function(e){var f,g;c<a.length?(f=a[c++],y(f)&&(f=B(f)),g=new q,d.setDisposable(g),g.setDisposable(f.subscribe(b.onNext.bind(b),function(){e()},function(){e()}))):b.onCompleted()});return new r(d,e)})};h.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).selectMany(function(a){return a.toArray()}).where(function(a){return a.length>0})},h.windowWithCount=function(a,b){var c=this;if(0>=a)throw new Error(D);if(1===arguments.length&&(b=a),0>=b)throw new Error(D);return new k(function(d){var e=new q,f=new s(e),g=0,h=[],i=function(){var a=new m;h.push(a),d.onNext(w(a,f))};return i(),e.setDisposable(c.subscribe(function(c){for(var d,e=0,f=h.length;f>e;e++)h[e].onNext(c);var j=g-a+1;j>=0&&j%b===0&&(d=h.shift(),d.onCompleted()),g++,g%b===0&&i()},function(a){for(;h.length>0;)h.shift().onError(a);d.onError(a)},function(){for(;h.length>0;)h.shift().onCompleted();d.onCompleted()})),f})},h.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new k(function(c){var d=!1;return b.subscribe(function(a){d=!0,c.onNext(a)},c.onError.bind(c),function(){d||c.onNext(a),c.onCompleted()})})},h.distinct=function(a,b){var c=this;return a||(a=x),b||(b=v),new k(function(d){var e={};return c.subscribe(function(c){var f,g,h,i=!1;try{f=a(c),g=b(f)}catch(j){return void d.onError(j)}for(h in e)if(g===h){i=!0;break}i||(e[g]=null,d.onNext(c))},d.onError.bind(d),d.onCompleted.bind(d))})},h.groupBy=function(a,b,c){return this.groupByUntil(a,b,function(){return i()},c)},h.groupByUntil=function(a,b,c,d){var e=this;return b||(b=x),d||(d=v),new k(function(f){var g={},h=new r,i=new s(h);return h.add(e.subscribe(function(e){var j,k,l,n,o,p,r,s,t,u;try{p=a(e),r=d(p)}catch(v){for(u in g)g[u].onError(v);return void f.onError(v)}n=!1;try{t=g[r],t||(t=new m,g[r]=t,n=!0)}catch(v){for(u in g)g[u].onError(v);return void f.onError(v)}if(n){o=new G(p,t,i),k=new G(p,t);try{j=c(k)}catch(v){for(u in g)g[u].onError(v);return void f.onError(v)}f.onNext(o),s=new q,h.add(s);var w=function(){r in g&&(delete g[r],t.onCompleted()),h.remove(s)};s.setDisposable(j.take(1).subscribe(A,function(a){for(u in g)g[u].onError(a);f.onError(a)},function(){w()}))}try{l=b(e)}catch(v){for(u in g)g[u].onError(v);return void f.onError(v)}t.onNext(l)},function(a){for(var b in g)g[b].onError(a);f.onError(a)},function(){for(var a in g)g[a].onCompleted();f.onCompleted()})),i})};var G=function(a){function b(a){return this.underlyingObservable.subscribe(a)}function c(c,d,e){a.call(this,b),this.key=c,this.underlyingObservable=e?new k(function(a){return new r(e.getDisposable(),d.subscribe(a))}):d}return z(c,a),c}(g);return c});