Comparing version 4.0.7 to 4.0.8
@@ -621,3 +621,3 @@ // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. | ||
observableProto.min = function (comparer) { | ||
return this.minBy(identity, comparer).map(function (x) { return firstOnly(x); }); | ||
return this.minBy(identity, comparer).map(firstOnly); | ||
}; | ||
@@ -648,3 +648,3 @@ | ||
observableProto.max = function (comparer) { | ||
return this.maxBy(identity, comparer).map(function (x) { return firstOnly(x); }); | ||
return this.maxBy(identity, comparer).map(firstOnly); | ||
}; | ||
@@ -651,0 +651,0 @@ |
/* 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 C.e=b,C}}}function f(a){if(0===a.length)throw new z;return a[0]}function g(a,b,c,d){var e=y(b,c,3);return new k(function(b){return a.subscribe(new da(b,a,e,d))},a)}var h=c.Observable,i=h.prototype,j=c.BinaryDisposable,k=c.AnonymousObservable,l=c.internals.AbstractObserver,m=c.Disposable.empty,n=c.helpers,o=n.defaultComparer,p=n.identity,q=n.defaultSubComparer,r=n.isFunction,s=n.isPromise,t=n.isArrayLike,u=n.isIterable,v=c.internals.inherits,w=h.fromPromise,x=h.from,y=c.internals.bindCallback,z=c.EmptyError,A=c.ObservableBase,B=c.ArgumentOutOfRangeError,C={e:{}},D=c.internals.tryCatch=function(a){if(!r(a))throw new TypeError("fn must be a function");return e(a)},E=function(a){function b(b,c,d){this.source=b,this._k=c,this._c=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new F(a,this._k,this._c))},b}(A),F=function(a){function b(b,c,d){this._o=b,this._k=c,this._c=d,this._v=null,this._hv=!1,this._l=[],a.call(this)}return v(b,a),b.prototype.next=function(a){var b=D(this._k)(a);if(b===C)return this._o.onError(b.e);var c=0;if(this._hv){if(c=D(this._c)(b,this._v),c===C)return this._o.onError(c.e)}else this._hv=!0,this._v=b;c>0&&(this._v=b,this._l=[]),c>=0&&this._l.push(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._l),this._o.onCompleted()},b}(l),G=function(a){function b(b,c,d,e){this.source=b,this.accumulator=c,this.hasSeed=d,this.seed=e,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new H(a,this))},b}(A),H=function(a){function b(b,c){this._o=b,this._p=c,this._fn=c.accumulator,this._hs=c.hasSeed,this._s=c.seed,this._ha=!1,this._a=null,this._hv=!1,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){return!this._hv&&(this._hv=!0),this._ha?this._a=D(this._fn)(this._a,a,this._i,this._p):(this._a=this._hs?D(this._fn)(this._s,a,this._i,this._p):a,this._ha=!0),this._a===C?this._o.onError(this._a.e):void this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv&&this._o.onNext(this._a),!this._hv&&this._hs&&this._o.onNext(this._s),!this._hv&&!this._hs&&this._o.onError(new z),this._o.onCompleted()},b}(l);i.reduce=function(){var a,b=!1,c=arguments[0];return 2===arguments.length&&(b=!0,a=arguments[1]),new G(this,c,b,a)};var I=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new J(a,this._fn,this.source))},b}(A),J=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){var b=D(this._fn)(a,this._i++,this._s);return b===C?this._o.onError(b.e):void(Boolean(b)&&(this._o.onNext(!0),this._o.onCompleted()))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},b}(l);i.some=function(a,b){var c=y(a,b,3);return new I(this,c)};var K=function(a){function b(b){this.source=b,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new L(a))},b}(A),L=function(a){function b(b){this._o=b,a.call(this)}return v(b,a),b.prototype.next=function(){this._o.onNext(!1),this._o.onCompleted()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},b}(l);i.isEmpty=function(){return new K(this)};var M=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new N(a,this._fn,this.source))},b}(A),N=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){var b=D(this._fn)(a,this._i++,this._s);return b===C?this._o.onError(b.e):void(Boolean(b)||(this._o.onNext(!1),this._o.onCompleted()))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},b}(l);i.every=function(a,b){var c=y(a,b,3);return new M(this,c)};var O=function(a){function b(b,c,d){var e=+d||0;Math.abs(e)===1/0&&(e=0),this.source=b,this._elem=c,this._n=e,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this._n<0?(a.onNext(!1),a.onCompleted(),m):this.source.subscribe(new P(a,this._elem,this._n))},b}(A),P=function(a){function b(b,c,d){this._o=b,this._elem=c,this._n=d,this._i=0,a.call(this)}function c(a,b){return 0===a&&0===b||a===b||isNaN(a)&&isNaN(b)}return v(b,a),b.prototype.next=function(a){this._i++>=this._n&&c(a,this._elem)&&(this._o.onNext(!0),this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},b}(l);i.includes=function(a,b){return new O(this,a,b)};var Q=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new R(a,this._fn,this.source))},b}(A),R=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,this._c=0,a.call(this)}return v(b,a),b.prototype.next=function(a){if(this._fn){var b=D(this._fn)(a,this._i++,this._s);if(b===C)return this._o.onError(b.e);Boolean(b)&&this._c++}else this._c++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},b}(l);i.count=function(a,b){var c=y(a,b,3);return new Q(this,c)};var S=function(a){function b(b,c,d){this.source=b,this._e=c,this._n=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this._n<0?(a.onNext(-1),a.onCompleted(),m):this.source.subscribe(new T(a,this._e,this._n))},b}(A),T=function(a){function b(b,c,d){this._o=b,this._e=c,this._n=d,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){this._i>=this._n&&a===this._e&&(this._o.onNext(this._i),this._o.onCompleted()),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(-1),this._o.onCompleted()},b}(l);i.indexOf=function(a,b){var c=+b||0;return Math.abs(c)===1/0&&(c=0),new S(this,a,c)};var U=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new V(a,this._fn,this.source))},b}(A),V=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,this._c=0,a.call(this)}return v(b,a),b.prototype.next=function(a){if(this._fn){var b=D(this._fn)(a,this._i++,this._s);if(b===C)return this._o.onError(b.e);this._c+=b}else this._c+=a},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},b}(l);i.sum=function(a,b){var c=y(a,b,3);return new U(this,c)},i.minBy=function(a,b){return b||(b=q),new E(this,a,function(a,c){return-1*b(a,c)})},i.min=function(a){return this.minBy(p,a).map(function(a){return f(a)})},i.maxBy=function(a,b){return b||(b=q),new E(this,a,b)},i.max=function(a){return this.maxBy(p,a).map(function(a){return f(a)})};var W=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new X(a,this._fn,this.source))},b}(A),X=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._c=0,this._t=0,a.call(this)}return v(b,a),b.prototype.next=function(a){if(this._fn){var b=D(this._fn)(a,this._c++,this._s);if(b===C)return this._o.onError(b.e);this._t+=b}else this._c++,this._t+=a},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){return 0===this._c?this._o.onError(new z):(this._o.onNext(this._t/this._c),void this._o.onCompleted())},b}(l);i.average=function(a,b){var c,d=this;return r(a)&&(c=y(a,b,3)),new W(d,c)},i.sequenceEqual=function(a,b){var c=this;return b||(b=o),new k(function(d){var e=!1,f=!1,g=[],h=[],i=c.subscribe(function(a){if(h.length>0){var c=h.shift(),e=D(b)(c,a);if(e===C)return d.onError(e.e);e||(d.onNext(!1),d.onCompleted())}else f?(d.onNext(!1),d.onCompleted()):g.push(a)},function(a){d.onError(a)},function(){e=!0,0===g.length&&(h.length>0?(d.onNext(!1),d.onCompleted()):f&&(d.onNext(!0),d.onCompleted()))});(t(a)||u(a))&&(a=x(a)),s(a)&&(a=w(a));var k=a.subscribe(function(a){if(g.length>0){var c=g.shift(),f=D(b)(c,a);if(f===C)return d.onError(f.e);f||(d.onNext(!1),d.onCompleted())}else e?(d.onNext(!1),d.onCompleted()):h.push(a)},function(a){d.onError(a)},function(){f=!0,0===h.length&&(g.length>0?(d.onNext(!1),d.onCompleted()):e&&(d.onNext(!0),d.onCompleted()))});return new j(i,k)},c)};var Y=function(a){function b(b,c,d){this.source=b,this._i=c,this._d=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Z(a,this._i,this._d))},b}(A),Z=function(a){function b(b,c,d){this._o=b,this._i=c,this._d=d,a.call(this)}return v(b,a),b.prototype.next=function(a){0===this._i--&&(this._o.onNext(a),this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._d===d?this._o.onError(new B):(this._o.onNext(this._d),this._o.onCompleted())},b}(l);i.elementAt=function(a,b){if(0>a)throw new B;return new Y(this,a,b)};var $=function(a){function b(b,c,d){this._o=b,this._obj=c,this._s=d,this._i=0,this._hv=!1,this._v=null,a.call(this)}return v(b,a),b.prototype.next=function(a){var b=!1;if(this._obj.predicate){var c=D(this._obj.predicate)(a,this._i++,this._s);if(c===C)return this._o.onError(c.e);Boolean(c)&&(b=!0)}else this._obj.predicate||(b=!0);if(b){if(this._hv)return this._o.onError(new Error("Sequence contains more than one matching element"));this._hv=!0,this._v=a}},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===d?this._o.onError(new z):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},b}(l);i.single=function(a,b){var c={},d=this;if(c="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},r(c.predicate)){var e=c.predicate;c.predicate=y(e,c.thisArg,3)}return new k(function(a){return d.subscribe(new $(a,c,d))},d)};var _=function(a){function b(b,c){this.source=b,this._obj=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new aa(a,this._obj,this.source))},b}(A),aa=function(a){function b(b,c,d){this._o=b,this._obj=c,this._s=d,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){if(this._obj.predicate){var b=D(this._obj.predicate)(a,this._i++,this._s);if(b===C)return this._o.onError(b.e);Boolean(b)&&(this._o.onNext(a),this._o.onCompleted())}else this._obj.predicate||(this._o.onNext(a),this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._obj.defaultValue===d?this._o.onError(new z):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},b}(l);i.first=function(){var a={};if(a="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},r(a.predicate)){var b=a.predicate;a.predicate=y(b,a.thisArg,3)}return new _(this,a)};var ba=function(a){function b(b,c){this.source=b,this._obj=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ca(a,this._obj,this.source))},b}(A),ca=function(a){function b(b,c,d){this._o=b,this._obj=c,this._s=d,this._i=0,this._hv=!1,this._v=null,a.call(this)}return v(b,a),b.prototype.next=function(a){var b=!1;if(this._obj.predicate){var c=D(this._obj.predicate)(a,this._i++,this._s);if(c===C)return this._o.onError(c.e);Boolean(c)&&(b=!0)}else this._obj.predicate||(b=!0);b&&(this._hv=!0,this._v=a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===d?this._o.onError(new z):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},b}(l);i.last=function(){var a={};if(a="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},r(a.predicate)){var b=a.predicate;a.predicate=y(b,a.thisArg,3)}return new ba(this,a)};var da=function(a){function b(b,c,d,e){this._o=b,this._s=c,this._cb=d,this._y=e,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){var b=D(this._cb)(a,this._i,this._s);return b===C?this._o.onError(b.e):void(b?(this._o.onNext(this._y?this._i:a),this._o.onCompleted()):this._i++)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._y&&this._o.onNext(-1),this._o.onCompleted()},b}(l);i.find=function(a,b){return g(this,a,b,!1)},i.findIndex=function(a,b){return g(this,a,b,!0)};var ea=function(a){function b(b){this.source=b,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new fa(a))},b}(A),fa=function(b){function c(c){this._o=c,this._s=new a.Set,b.call(this)}return v(c,b),c.prototype.next=function(a){this._s.add(a)},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._o.onNext(this._s),this._o.onCompleted()},c}(l);i.toSet=function(){if("undefined"==typeof a.Set)throw new TypeError;return new ea(this)};var ga=function(a){function b(b,c,d){this.source=b,this._k=c,this._e=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ha(a,this._k,this._e))},b}(A),ha=function(b){function c(c,d,e){this._o=c,this._k=d,this._e=e,this._m=new a.Map,b.call(this)}return v(c,b),c.prototype.next=function(a){var b=D(this._k)(a);if(b===C)return this._o.onError(b.e);var c=a;return this._e&&(c=D(this._e)(a),c===C)?this._o.onError(c.e):void this._m.set(b,c)},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._o.onNext(this._m),this._o.onCompleted()},c}(l);i.toMap=function(b,c){if("undefined"==typeof a.Map)throw new TypeError;return new ga(this,b,c)};var ia=function(a){function b(b,c,d){this.source=b,this._b=c,this._e=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ja(a,this._b,this._e))},b}(A),ja=function(a){function b(b,c,d){this._o=b,this._b=c,this._e=d,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){this._i>=this._b&&(this._e===this._i?this._o.onCompleted():this._o.onNext(a)),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(l);i.slice=function(a,b){var d=a||0;if(0>d)throw new c.ArgumentOutOfRangeError;if("number"==typeof b&&d>b)throw new c.ArgumentOutOfRangeError;return new ia(this,d,b)};var ka=function(a){function b(b,c,d){this.source=b,this._e=c,this._n=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this._n<0?(a.onNext(-1),a.onCompleted(),m):this.source.subscribe(new la(a,this._e,this._n))},b}(A),la=function(a){function b(b,c,d){this._o=b,this._e=c,this._n=d,this._v=0,this._hv=!1,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){this._i>=this._n&&a===this._e&&(this._hv=!0,this._v=this._i),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv?this._o.onNext(this._v):this._o.onNext(-1),this._o.onCompleted()},b}(l);return i.lastIndexOf=function(a,b){var c=+b||0;return Math.abs(c)===1/0&&(c=0),new ka(this,a,c)},c}); | ||
(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 C.e=b,C}}}function f(a){if(0===a.length)throw new z;return a[0]}function g(a,b,c,d){var e=y(b,c,3);return new k(function(b){return a.subscribe(new da(b,a,e,d))},a)}var h=c.Observable,i=h.prototype,j=c.BinaryDisposable,k=c.AnonymousObservable,l=c.internals.AbstractObserver,m=c.Disposable.empty,n=c.helpers,o=n.defaultComparer,p=n.identity,q=n.defaultSubComparer,r=n.isFunction,s=n.isPromise,t=n.isArrayLike,u=n.isIterable,v=c.internals.inherits,w=h.fromPromise,x=h.from,y=c.internals.bindCallback,z=c.EmptyError,A=c.ObservableBase,B=c.ArgumentOutOfRangeError,C={e:{}},D=c.internals.tryCatch=function(a){if(!r(a))throw new TypeError("fn must be a function");return e(a)},E=function(a){function b(b,c,d){this.source=b,this._k=c,this._c=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new F(a,this._k,this._c))},b}(A),F=function(a){function b(b,c,d){this._o=b,this._k=c,this._c=d,this._v=null,this._hv=!1,this._l=[],a.call(this)}return v(b,a),b.prototype.next=function(a){var b=D(this._k)(a);if(b===C)return this._o.onError(b.e);var c=0;if(this._hv){if(c=D(this._c)(b,this._v),c===C)return this._o.onError(c.e)}else this._hv=!0,this._v=b;c>0&&(this._v=b,this._l=[]),c>=0&&this._l.push(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._l),this._o.onCompleted()},b}(l),G=function(a){function b(b,c,d,e){this.source=b,this.accumulator=c,this.hasSeed=d,this.seed=e,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new H(a,this))},b}(A),H=function(a){function b(b,c){this._o=b,this._p=c,this._fn=c.accumulator,this._hs=c.hasSeed,this._s=c.seed,this._ha=!1,this._a=null,this._hv=!1,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){return!this._hv&&(this._hv=!0),this._ha?this._a=D(this._fn)(this._a,a,this._i,this._p):(this._a=this._hs?D(this._fn)(this._s,a,this._i,this._p):a,this._ha=!0),this._a===C?this._o.onError(this._a.e):void this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv&&this._o.onNext(this._a),!this._hv&&this._hs&&this._o.onNext(this._s),!this._hv&&!this._hs&&this._o.onError(new z),this._o.onCompleted()},b}(l);i.reduce=function(){var a,b=!1,c=arguments[0];return 2===arguments.length&&(b=!0,a=arguments[1]),new G(this,c,b,a)};var I=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new J(a,this._fn,this.source))},b}(A),J=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){var b=D(this._fn)(a,this._i++,this._s);return b===C?this._o.onError(b.e):void(Boolean(b)&&(this._o.onNext(!0),this._o.onCompleted()))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},b}(l);i.some=function(a,b){var c=y(a,b,3);return new I(this,c)};var K=function(a){function b(b){this.source=b,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new L(a))},b}(A),L=function(a){function b(b){this._o=b,a.call(this)}return v(b,a),b.prototype.next=function(){this._o.onNext(!1),this._o.onCompleted()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},b}(l);i.isEmpty=function(){return new K(this)};var M=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new N(a,this._fn,this.source))},b}(A),N=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){var b=D(this._fn)(a,this._i++,this._s);return b===C?this._o.onError(b.e):void(Boolean(b)||(this._o.onNext(!1),this._o.onCompleted()))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!0),this._o.onCompleted()},b}(l);i.every=function(a,b){var c=y(a,b,3);return new M(this,c)};var O=function(a){function b(b,c,d){var e=+d||0;Math.abs(e)===1/0&&(e=0),this.source=b,this._elem=c,this._n=e,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this._n<0?(a.onNext(!1),a.onCompleted(),m):this.source.subscribe(new P(a,this._elem,this._n))},b}(A),P=function(a){function b(b,c,d){this._o=b,this._elem=c,this._n=d,this._i=0,a.call(this)}function c(a,b){return 0===a&&0===b||a===b||isNaN(a)&&isNaN(b)}return v(b,a),b.prototype.next=function(a){this._i++>=this._n&&c(a,this._elem)&&(this._o.onNext(!0),this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(!1),this._o.onCompleted()},b}(l);i.includes=function(a,b){return new O(this,a,b)};var Q=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new R(a,this._fn,this.source))},b}(A),R=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,this._c=0,a.call(this)}return v(b,a),b.prototype.next=function(a){if(this._fn){var b=D(this._fn)(a,this._i++,this._s);if(b===C)return this._o.onError(b.e);Boolean(b)&&this._c++}else this._c++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},b}(l);i.count=function(a,b){var c=y(a,b,3);return new Q(this,c)};var S=function(a){function b(b,c,d){this.source=b,this._e=c,this._n=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this._n<0?(a.onNext(-1),a.onCompleted(),m):this.source.subscribe(new T(a,this._e,this._n))},b}(A),T=function(a){function b(b,c,d){this._o=b,this._e=c,this._n=d,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){this._i>=this._n&&a===this._e&&(this._o.onNext(this._i),this._o.onCompleted()),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(-1),this._o.onCompleted()},b}(l);i.indexOf=function(a,b){var c=+b||0;return Math.abs(c)===1/0&&(c=0),new S(this,a,c)};var U=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new V(a,this._fn,this.source))},b}(A),V=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._i=0,this._c=0,a.call(this)}return v(b,a),b.prototype.next=function(a){if(this._fn){var b=D(this._fn)(a,this._i++,this._s);if(b===C)return this._o.onError(b.e);this._c+=b}else this._c+=a},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._c),this._o.onCompleted()},b}(l);i.sum=function(a,b){var c=y(a,b,3);return new U(this,c)},i.minBy=function(a,b){return b||(b=q),new E(this,a,function(a,c){return-1*b(a,c)})},i.min=function(a){return this.minBy(p,a).map(f)},i.maxBy=function(a,b){return b||(b=q),new E(this,a,b)},i.max=function(a){return this.maxBy(p,a).map(f)};var W=function(a){function b(b,c){this.source=b,this._fn=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new X(a,this._fn,this.source))},b}(A),X=function(a){function b(b,c,d){this._o=b,this._fn=c,this._s=d,this._c=0,this._t=0,a.call(this)}return v(b,a),b.prototype.next=function(a){if(this._fn){var b=D(this._fn)(a,this._c++,this._s);if(b===C)return this._o.onError(b.e);this._t+=b}else this._c++,this._t+=a},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){return 0===this._c?this._o.onError(new z):(this._o.onNext(this._t/this._c),void this._o.onCompleted())},b}(l);i.average=function(a,b){var c,d=this;return r(a)&&(c=y(a,b,3)),new W(d,c)},i.sequenceEqual=function(a,b){var c=this;return b||(b=o),new k(function(d){var e=!1,f=!1,g=[],h=[],i=c.subscribe(function(a){if(h.length>0){var c=h.shift(),e=D(b)(c,a);if(e===C)return d.onError(e.e);e||(d.onNext(!1),d.onCompleted())}else f?(d.onNext(!1),d.onCompleted()):g.push(a)},function(a){d.onError(a)},function(){e=!0,0===g.length&&(h.length>0?(d.onNext(!1),d.onCompleted()):f&&(d.onNext(!0),d.onCompleted()))});(t(a)||u(a))&&(a=x(a)),s(a)&&(a=w(a));var k=a.subscribe(function(a){if(g.length>0){var c=g.shift(),f=D(b)(c,a);if(f===C)return d.onError(f.e);f||(d.onNext(!1),d.onCompleted())}else e?(d.onNext(!1),d.onCompleted()):h.push(a)},function(a){d.onError(a)},function(){f=!0,0===h.length&&(g.length>0?(d.onNext(!1),d.onCompleted()):e&&(d.onNext(!0),d.onCompleted()))});return new j(i,k)},c)};var Y=function(a){function b(b,c,d){this.source=b,this._i=c,this._d=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new Z(a,this._i,this._d))},b}(A),Z=function(a){function b(b,c,d){this._o=b,this._i=c,this._d=d,a.call(this)}return v(b,a),b.prototype.next=function(a){0===this._i--&&(this._o.onNext(a),this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._d===d?this._o.onError(new B):(this._o.onNext(this._d),this._o.onCompleted())},b}(l);i.elementAt=function(a,b){if(0>a)throw new B;return new Y(this,a,b)};var $=function(a){function b(b,c,d){this._o=b,this._obj=c,this._s=d,this._i=0,this._hv=!1,this._v=null,a.call(this)}return v(b,a),b.prototype.next=function(a){var b=!1;if(this._obj.predicate){var c=D(this._obj.predicate)(a,this._i++,this._s);if(c===C)return this._o.onError(c.e);Boolean(c)&&(b=!0)}else this._obj.predicate||(b=!0);if(b){if(this._hv)return this._o.onError(new Error("Sequence contains more than one matching element"));this._hv=!0,this._v=a}},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===d?this._o.onError(new z):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},b}(l);i.single=function(a,b){var c={},d=this;if(c="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},r(c.predicate)){var e=c.predicate;c.predicate=y(e,c.thisArg,3)}return new k(function(a){return d.subscribe(new $(a,c,d))},d)};var _=function(a){function b(b,c){this.source=b,this._obj=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new aa(a,this._obj,this.source))},b}(A),aa=function(a){function b(b,c,d){this._o=b,this._obj=c,this._s=d,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){if(this._obj.predicate){var b=D(this._obj.predicate)(a,this._i++,this._s);if(b===C)return this._o.onError(b.e);Boolean(b)&&(this._o.onNext(a),this._o.onCompleted())}else this._obj.predicate||(this._o.onNext(a),this._o.onCompleted())},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._obj.defaultValue===d?this._o.onError(new z):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},b}(l);i.first=function(){var a={};if(a="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},r(a.predicate)){var b=a.predicate;a.predicate=y(b,a.thisArg,3)}return new _(this,a)};var ba=function(a){function b(b,c){this.source=b,this._obj=c,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ca(a,this._obj,this.source))},b}(A),ca=function(a){function b(b,c,d){this._o=b,this._obj=c,this._s=d,this._i=0,this._hv=!1,this._v=null,a.call(this)}return v(b,a),b.prototype.next=function(a){var b=!1;if(this._obj.predicate){var c=D(this._obj.predicate)(a,this._i++,this._s);if(c===C)return this._o.onError(c.e);Boolean(c)&&(b=!0)}else this._obj.predicate||(b=!0);b&&(this._hv=!0,this._v=a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv?(this._o.onNext(this._v),this._o.onCompleted()):this._obj.defaultValue===d?this._o.onError(new z):(this._o.onNext(this._obj.defaultValue),this._o.onCompleted())},b}(l);i.last=function(){var a={};if(a="object"==typeof arguments[0]?arguments[0]:{predicate:arguments[0],thisArg:arguments[1],defaultValue:arguments[2]},r(a.predicate)){var b=a.predicate;a.predicate=y(b,a.thisArg,3)}return new ba(this,a)};var da=function(a){function b(b,c,d,e){this._o=b,this._s=c,this._cb=d,this._y=e,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){var b=D(this._cb)(a,this._i,this._s);return b===C?this._o.onError(b.e):void(b?(this._o.onNext(this._y?this._i:a),this._o.onCompleted()):this._i++)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._y&&this._o.onNext(-1),this._o.onCompleted()},b}(l);i.find=function(a,b){return g(this,a,b,!1)},i.findIndex=function(a,b){return g(this,a,b,!0)};var ea=function(a){function b(b){this.source=b,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new fa(a))},b}(A),fa=function(b){function c(c){this._o=c,this._s=new a.Set,b.call(this)}return v(c,b),c.prototype.next=function(a){this._s.add(a)},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._o.onNext(this._s),this._o.onCompleted()},c}(l);i.toSet=function(){if("undefined"==typeof a.Set)throw new TypeError;return new ea(this)};var ga=function(a){function b(b,c,d){this.source=b,this._k=c,this._e=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ha(a,this._k,this._e))},b}(A),ha=function(b){function c(c,d,e){this._o=c,this._k=d,this._e=e,this._m=new a.Map,b.call(this)}return v(c,b),c.prototype.next=function(a){var b=D(this._k)(a);if(b===C)return this._o.onError(b.e);var c=a;return this._e&&(c=D(this._e)(a),c===C)?this._o.onError(c.e):void this._m.set(b,c)},c.prototype.error=function(a){this._o.onError(a)},c.prototype.completed=function(){this._o.onNext(this._m),this._o.onCompleted()},c}(l);i.toMap=function(b,c){if("undefined"==typeof a.Map)throw new TypeError;return new ga(this,b,c)};var ia=function(a){function b(b,c,d){this.source=b,this._b=c,this._e=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ja(a,this._b,this._e))},b}(A),ja=function(a){function b(b,c,d){this._o=b,this._b=c,this._e=d,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){this._i>=this._b&&(this._e===this._i?this._o.onCompleted():this._o.onNext(a)),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(l);i.slice=function(a,b){var d=a||0;if(0>d)throw new c.ArgumentOutOfRangeError;if("number"==typeof b&&d>b)throw new c.ArgumentOutOfRangeError;return new ia(this,d,b)};var ka=function(a){function b(b,c,d){this.source=b,this._e=c,this._n=d,a.call(this)}return v(b,a),b.prototype.subscribeCore=function(a){return this._n<0?(a.onNext(-1),a.onCompleted(),m):this.source.subscribe(new la(a,this._e,this._n))},b}(A),la=function(a){function b(b,c,d){this._o=b,this._e=c,this._n=d,this._v=0,this._hv=!1,this._i=0,a.call(this)}return v(b,a),b.prototype.next=function(a){this._i>=this._n&&a===this._e&&(this._hv=!0,this._v=this._i),this._i++},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._hv?this._o.onNext(this._v):this._o.onNext(-1),this._o.onCompleted()},b}(l);return i.lastIndexOf=function(a,b){var c=+b||0;return Math.abs(c)===1/0&&(c=0),new ka(this,a,c)},c}); | ||
//# sourceMappingURL=rx.aggregates.map |
@@ -502,2 +502,3 @@ // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. | ||
isFunction(this._del) && this._del(this._fn, this._ret); | ||
this.isDisposed = true; | ||
} | ||
@@ -504,0 +505,0 @@ }; |
/* 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.binding","exports"],function(b,c){return j.Rx=a(j,c,b),j.Rx}):"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 H.e=b,H}}}function f(a){return a?t.isObservable(a)?a:D(a)?t.fromPromise(a):k(a)||j(a)?J.call(this,a):E(a)?i.call(this,a):G(a)||F(a)?g.call(this,a):l(a)?h.call(this,a):a:a}function g(a){return t.from(a).concatMap(function(a){return t.isObservable(a)||l(a)?f.call(null,a):c.Observable.just(a)}).toArray()}function h(a){function b(a,b){c[b]=d,g.push(a.map(function(a){c[b]=a}))}for(var c=new a.constructor,e=Object.keys(a),g=[],h=0,i=e.length;i>h;h++){var j=e[h],k=f.call(this,a[j]);k&&t.isObservable(k)?b(k,j):c[j]=a[j]}return t.forkJoin.apply(t,g).map(function(){return c})}function i(a){var b=this;return new w(function(c){a.call(b,function(){var a=arguments[0],b=arguments[1];if(a)return c.onError(a);if(arguments.length>2){for(var d=[],e=1,f=arguments.length;f>e;e++)d.push(arguments[e]);b=d}c.onNext(b),c.onCompleted()})})}function j(a){return E(a.next)&&E(a["throw"])}function k(a){var b=a.constructor;return b?"GeneratorFunction"===b.name||"GeneratorFunction"===b.displayName?!0:j(b.prototype):!1}function l(a){return Object==a.constructor}function m(a,b,c,d){var e=new y;return d.push(n(e,b,c)),a.apply(b,d),e.asObservable()}function n(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];if(E(c)){if(e=I(c).apply(b,e),e===H)return a.onError(e.e);a.onNext(e)}else e.length<=1?a.onNext(e[0]):a.onNext(e);a.onCompleted()}}function o(a,b,c,d){var e=new y;return d.push(p(e,b,c)),a.apply(b,d),e.asObservable()}function p(a,b,c){return function(){var d=arguments[0];if(d)return a.onError(d);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(E(c)){var f=I(c).apply(b,f);if(f===H)return a.onError(f.e);a.onNext(f)}else f.length<=1?a.onNext(f[0]):a.onNext(f);a.onCompleted()}}function q(b){return a.StaticNodeList?b instanceof a.StaticNodeList||b instanceof a.NodeList:"[object NodeList]"===Object.prototype.toString.call(b)}function r(a,b,c){this._e=a,this._n=b,this._fn=c,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function s(a,b,c){var d=new z,e=Object.prototype.toString.call(a);if(q(a)||"[object HTMLCollection]"===e)for(var f=0,g=a.length;g>f;f++)d.add(s(a.item(f),b,c));else a&&d.add(new r(a,b,c));return d}var t=c.Observable,u=t.fromPromise,v=t.throwError,w=c.AnonymousObservable,x=c.ObservableBase,y=c.AsyncSubject,z=(c.Disposable.create,c.CompositeDisposable),A=(c.Scheduler.immediate,c.Scheduler["default"]),B=c.internals.inherits,C=c.Scheduler.isScheduler,D=c.helpers.isPromise,E=c.helpers.isFunction,F=c.helpers.isIterable,G=c.helpers.isArrayLike,H={e:{}},I=c.internals.tryCatch=function(a){if(!E(a))throw new TypeError("fn must be a function");return e(a)};t.wrap=function(a){function b(){return t.spawn.call(this,a.apply(this,arguments))}return b.__generatorFunction__=a,b};var J=t.spawn=function(){for(var a=arguments[0],b=this,c=[],d=1,e=arguments.length;e>d;d++)c.push(arguments[d]);return new w(function(d){function e(b){var c=I(a.next).call(a,b);return c===H?d.onError(c.e):void h(c)}function g(b){var c=I(a.next).call(a,b);return c===H?d.onError(c.e):void h(c)}function h(a){if(a.done)return d.onNext(a.value),void d.onCompleted();var c=f.call(b,a.value),h=null,j=!1;t.isObservable(c)?i.add(c.subscribe(function(a){j=!0,h=a},g,function(){j&&e(h)})):g(new TypeError("type not supported"))}var i=new z;return E(a)&&(a=a.apply(b,c)),a&&E(a.next)?(e(),i):(d.onNext(a),d.onCompleted())})};t.start=function(a,b,c){return K(a,b,c)()};var K=t.toAsync=function(a,b,c){return C(c)||(c=A),function(){var d=arguments,e=new y;return c.schedule(null,function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};t.fromCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return m(a,b,c,e)}},t.fromNodeCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return o(a,b,c,e)}},r.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},c.config.useNativeEvents=!1;var L=function(a){function b(b,c,d){this._el=b,this._n=c,this._fn=d,a.call(this)}function c(a,b){return function(){var c=arguments[0];return E(b)&&(c=I(b).apply(null,arguments),c===H)?a.onError(c.e):void a.onNext(c)}}return B(b,a),b.prototype.subscribeCore=function(a){return s(this._el,this._n,c(a,this._fn))},b}(x);t.fromEvent=function(a,b,d){return a.addListener?N(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new L(a,b,d).publish().refCount():N(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var M=function(a){function b(b,c,d){this._add=b,this._del=c,this._fn=d,a.call(this)}function c(a,b){return function(){var c=arguments[0];return E(b)&&(c=I(b).apply(null,arguments),c===H)?a.onError(c.e):void a.onNext(c)}}function d(a,b,c){this._del=a,this._fn=b,this._ret=c,this.isDisposed=!1}return B(b,a),b.prototype.subscribeCore=function(a){var b=c(a,this._fn),e=this._add(b);return new d(this._del,b,e)},d.prototype.dispose=function(){this.isDisposed||E(this._del)&&this._del(this._fn,this._ret)},b}(x),N=t.fromEventPattern=function(a,b,c){return new M(a,b,c).publish().refCount()};return t.startAsync=function(a){var b=I(a)();return b===H?v(b.e):u(b)},c}); | ||
(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.binding","exports"],function(b,c){return j.Rx=a(j,c,b),j.Rx}):"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 H.e=b,H}}}function f(a){return a?t.isObservable(a)?a:D(a)?t.fromPromise(a):k(a)||j(a)?J.call(this,a):E(a)?i.call(this,a):G(a)||F(a)?g.call(this,a):l(a)?h.call(this,a):a:a}function g(a){return t.from(a).concatMap(function(a){return t.isObservable(a)||l(a)?f.call(null,a):c.Observable.just(a)}).toArray()}function h(a){function b(a,b){c[b]=d,g.push(a.map(function(a){c[b]=a}))}for(var c=new a.constructor,e=Object.keys(a),g=[],h=0,i=e.length;i>h;h++){var j=e[h],k=f.call(this,a[j]);k&&t.isObservable(k)?b(k,j):c[j]=a[j]}return t.forkJoin.apply(t,g).map(function(){return c})}function i(a){var b=this;return new w(function(c){a.call(b,function(){var a=arguments[0],b=arguments[1];if(a)return c.onError(a);if(arguments.length>2){for(var d=[],e=1,f=arguments.length;f>e;e++)d.push(arguments[e]);b=d}c.onNext(b),c.onCompleted()})})}function j(a){return E(a.next)&&E(a["throw"])}function k(a){var b=a.constructor;return b?"GeneratorFunction"===b.name||"GeneratorFunction"===b.displayName?!0:j(b.prototype):!1}function l(a){return Object==a.constructor}function m(a,b,c,d){var e=new y;return d.push(n(e,b,c)),a.apply(b,d),e.asObservable()}function n(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];if(E(c)){if(e=I(c).apply(b,e),e===H)return a.onError(e.e);a.onNext(e)}else e.length<=1?a.onNext(e[0]):a.onNext(e);a.onCompleted()}}function o(a,b,c,d){var e=new y;return d.push(p(e,b,c)),a.apply(b,d),e.asObservable()}function p(a,b,c){return function(){var d=arguments[0];if(d)return a.onError(d);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(E(c)){var f=I(c).apply(b,f);if(f===H)return a.onError(f.e);a.onNext(f)}else f.length<=1?a.onNext(f[0]):a.onNext(f);a.onCompleted()}}function q(b){return a.StaticNodeList?b instanceof a.StaticNodeList||b instanceof a.NodeList:"[object NodeList]"===Object.prototype.toString.call(b)}function r(a,b,c){this._e=a,this._n=b,this._fn=c,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function s(a,b,c){var d=new z,e=Object.prototype.toString.call(a);if(q(a)||"[object HTMLCollection]"===e)for(var f=0,g=a.length;g>f;f++)d.add(s(a.item(f),b,c));else a&&d.add(new r(a,b,c));return d}var t=c.Observable,u=t.fromPromise,v=t.throwError,w=c.AnonymousObservable,x=c.ObservableBase,y=c.AsyncSubject,z=(c.Disposable.create,c.CompositeDisposable),A=(c.Scheduler.immediate,c.Scheduler["default"]),B=c.internals.inherits,C=c.Scheduler.isScheduler,D=c.helpers.isPromise,E=c.helpers.isFunction,F=c.helpers.isIterable,G=c.helpers.isArrayLike,H={e:{}},I=c.internals.tryCatch=function(a){if(!E(a))throw new TypeError("fn must be a function");return e(a)};t.wrap=function(a){function b(){return t.spawn.call(this,a.apply(this,arguments))}return b.__generatorFunction__=a,b};var J=t.spawn=function(){for(var a=arguments[0],b=this,c=[],d=1,e=arguments.length;e>d;d++)c.push(arguments[d]);return new w(function(d){function e(b){var c=I(a.next).call(a,b);return c===H?d.onError(c.e):void h(c)}function g(b){var c=I(a.next).call(a,b);return c===H?d.onError(c.e):void h(c)}function h(a){if(a.done)return d.onNext(a.value),void d.onCompleted();var c=f.call(b,a.value),h=null,j=!1;t.isObservable(c)?i.add(c.subscribe(function(a){j=!0,h=a},g,function(){j&&e(h)})):g(new TypeError("type not supported"))}var i=new z;return E(a)&&(a=a.apply(b,c)),a&&E(a.next)?(e(),i):(d.onNext(a),d.onCompleted())})};t.start=function(a,b,c){return K(a,b,c)()};var K=t.toAsync=function(a,b,c){return C(c)||(c=A),function(){var d=arguments,e=new y;return c.schedule(null,function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};t.fromCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return m(a,b,c,e)}},t.fromNodeCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return o(a,b,c,e)}},r.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},c.config.useNativeEvents=!1;var L=function(a){function b(b,c,d){this._el=b,this._n=c,this._fn=d,a.call(this)}function c(a,b){return function(){var c=arguments[0];return E(b)&&(c=I(b).apply(null,arguments),c===H)?a.onError(c.e):void a.onNext(c)}}return B(b,a),b.prototype.subscribeCore=function(a){return s(this._el,this._n,c(a,this._fn))},b}(x);t.fromEvent=function(a,b,d){return a.addListener?N(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new L(a,b,d).publish().refCount():N(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var M=function(a){function b(b,c,d){this._add=b,this._del=c,this._fn=d,a.call(this)}function c(a,b){return function(){var c=arguments[0];return E(b)&&(c=I(b).apply(null,arguments),c===H)?a.onError(c.e):void a.onNext(c)}}function d(a,b,c){this._del=a,this._fn=b,this._ret=c,this.isDisposed=!1}return B(b,a),b.prototype.subscribeCore=function(a){var b=c(a,this._fn),e=this._add(b);return new d(this._del,b,e)},d.prototype.dispose=function(){this.isDisposed||(E(this._del)&&this._del(this._fn,this._ret),this.isDisposed=!0)},b}(x),N=t.fromEventPattern=function(a,b,c){return new M(a,b,c).publish().refCount()};return t.startAsync=function(a){var b=I(a)();return b===H?v(b.e):u(b)},c}); | ||
//# sourceMappingURL=rx.async.compat.map |
@@ -502,2 +502,3 @@ // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. | ||
isFunction(this._del) && this._del(this._fn, this._ret); | ||
this.isDisposed = true; | ||
} | ||
@@ -504,0 +505,0 @@ }; |
/* 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.binding","exports"],function(b,c){return j.Rx=a(j,c,b),j.Rx}):"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 H.e=b,H}}}function f(a){return a?t.isObservable(a)?a:D(a)?t.fromPromise(a):k(a)||j(a)?J.call(this,a):E(a)?i.call(this,a):G(a)||F(a)?g.call(this,a):l(a)?h.call(this,a):a:a}function g(a){return t.from(a).concatMap(function(a){return t.isObservable(a)||l(a)?f.call(null,a):c.Observable.just(a)}).toArray()}function h(a){function b(a,b){c[b]=d,g.push(a.map(function(a){c[b]=a}))}for(var c=new a.constructor,e=Object.keys(a),g=[],h=0,i=e.length;i>h;h++){var j=e[h],k=f.call(this,a[j]);k&&t.isObservable(k)?b(k,j):c[j]=a[j]}return t.forkJoin.apply(t,g).map(function(){return c})}function i(a){var b=this;return new w(function(c){a.call(b,function(){var a=arguments[0],b=arguments[1];if(a)return c.onError(a);if(arguments.length>2){for(var d=[],e=1,f=arguments.length;f>e;e++)d.push(arguments[e]);b=d}c.onNext(b),c.onCompleted()})})}function j(a){return E(a.next)&&E(a["throw"])}function k(a){var b=a.constructor;return b?"GeneratorFunction"===b.name||"GeneratorFunction"===b.displayName?!0:j(b.prototype):!1}function l(a){return Object==a.constructor}function m(a,b,c,d){var e=new y;return d.push(n(e,b,c)),a.apply(b,d),e.asObservable()}function n(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];if(E(c)){if(e=I(c).apply(b,e),e===H)return a.onError(e.e);a.onNext(e)}else e.length<=1?a.onNext(e[0]):a.onNext(e);a.onCompleted()}}function o(a,b,c,d){var e=new y;return d.push(p(e,b,c)),a.apply(b,d),e.asObservable()}function p(a,b,c){return function(){var d=arguments[0];if(d)return a.onError(d);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(E(c)){var f=I(c).apply(b,f);if(f===H)return a.onError(f.e);a.onNext(f)}else f.length<=1?a.onNext(f[0]):a.onNext(f);a.onCompleted()}}function q(b){return a.StaticNodeList?b instanceof a.StaticNodeList||b instanceof a.NodeList:"[object NodeList]"===Object.prototype.toString.call(b)}function r(a,b,c){this._e=a,this._n=b,this._fn=c,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function s(a,b,c){var d=new z,e=Object.prototype.toString.call(a);if(q(a)||"[object HTMLCollection]"===e)for(var f=0,g=a.length;g>f;f++)d.add(s(a.item(f),b,c));else a&&d.add(new r(a,b,c));return d}var t=c.Observable,u=t.fromPromise,v=t.throwError,w=c.AnonymousObservable,x=c.ObservableBase,y=c.AsyncSubject,z=(c.Disposable.create,c.CompositeDisposable),A=(c.Scheduler.immediate,c.Scheduler["default"]),B=c.internals.inherits,C=c.Scheduler.isScheduler,D=c.helpers.isPromise,E=c.helpers.isFunction,F=c.helpers.isIterable,G=c.helpers.isArrayLike,H={e:{}},I=c.internals.tryCatch=function(a){if(!E(a))throw new TypeError("fn must be a function");return e(a)};t.wrap=function(a){function b(){return t.spawn.call(this,a.apply(this,arguments))}return b.__generatorFunction__=a,b};var J=t.spawn=function(){for(var a=arguments[0],b=this,c=[],d=1,e=arguments.length;e>d;d++)c.push(arguments[d]);return new w(function(d){function e(b){var c=I(a.next).call(a,b);return c===H?d.onError(c.e):void h(c)}function g(b){var c=I(a.next).call(a,b);return c===H?d.onError(c.e):void h(c)}function h(a){if(a.done)return d.onNext(a.value),void d.onCompleted();var c=f.call(b,a.value),h=null,j=!1;t.isObservable(c)?i.add(c.subscribe(function(a){j=!0,h=a},g,function(){j&&e(h)})):g(new TypeError("type not supported"))}var i=new z;return E(a)&&(a=a.apply(b,c)),a&&E(a.next)?(e(),i):(d.onNext(a),d.onCompleted())})};t.start=function(a,b,c){return K(a,b,c)()};var K=t.toAsync=function(a,b,c){return C(c)||(c=A),function(){var d=arguments,e=new y;return c.schedule(null,function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};t.fromCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return m(a,b,c,e)}},t.fromNodeCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return o(a,b,c,e)}},r.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},c.config.useNativeEvents=!1;var L=function(a){function b(b,c,d){this._el=b,this._n=c,this._fn=d,a.call(this)}function c(a,b){return function(){var c=arguments[0];return E(b)&&(c=I(b).apply(null,arguments),c===H)?a.onError(c.e):void a.onNext(c)}}return B(b,a),b.prototype.subscribeCore=function(a){return s(this._el,this._n,c(a,this._fn))},b}(x);t.fromEvent=function(a,b,d){return a.addListener?N(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new L(a,b,d).publish().refCount():N(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var M=function(a){function b(b,c,d){this._add=b,this._del=c,this._fn=d,a.call(this)}function c(a,b){return function(){var c=arguments[0];return E(b)&&(c=I(b).apply(null,arguments),c===H)?a.onError(c.e):void a.onNext(c)}}function d(a,b,c){this._del=a,this._fn=b,this._ret=c,this.isDisposed=!1}return B(b,a),b.prototype.subscribeCore=function(a){var b=c(a,this._fn),e=this._add(b);return new d(this._del,b,e)},d.prototype.dispose=function(){this.isDisposed||E(this._del)&&this._del(this._fn,this._ret)},b}(x),N=t.fromEventPattern=function(a,b,c){return new M(a,b,c).publish().refCount()};return t.startAsync=function(a){var b=I(a)();return b===H?v(b.e):u(b)},c}); | ||
(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.binding","exports"],function(b,c){return j.Rx=a(j,c,b),j.Rx}):"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 H.e=b,H}}}function f(a){return a?t.isObservable(a)?a:D(a)?t.fromPromise(a):k(a)||j(a)?J.call(this,a):E(a)?i.call(this,a):G(a)||F(a)?g.call(this,a):l(a)?h.call(this,a):a:a}function g(a){return t.from(a).concatMap(function(a){return t.isObservable(a)||l(a)?f.call(null,a):c.Observable.just(a)}).toArray()}function h(a){function b(a,b){c[b]=d,g.push(a.map(function(a){c[b]=a}))}for(var c=new a.constructor,e=Object.keys(a),g=[],h=0,i=e.length;i>h;h++){var j=e[h],k=f.call(this,a[j]);k&&t.isObservable(k)?b(k,j):c[j]=a[j]}return t.forkJoin.apply(t,g).map(function(){return c})}function i(a){var b=this;return new w(function(c){a.call(b,function(){var a=arguments[0],b=arguments[1];if(a)return c.onError(a);if(arguments.length>2){for(var d=[],e=1,f=arguments.length;f>e;e++)d.push(arguments[e]);b=d}c.onNext(b),c.onCompleted()})})}function j(a){return E(a.next)&&E(a["throw"])}function k(a){var b=a.constructor;return b?"GeneratorFunction"===b.name||"GeneratorFunction"===b.displayName?!0:j(b.prototype):!1}function l(a){return Object==a.constructor}function m(a,b,c,d){var e=new y;return d.push(n(e,b,c)),a.apply(b,d),e.asObservable()}function n(a,b,c){return function(){for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];if(E(c)){if(e=I(c).apply(b,e),e===H)return a.onError(e.e);a.onNext(e)}else e.length<=1?a.onNext(e[0]):a.onNext(e);a.onCompleted()}}function o(a,b,c,d){var e=new y;return d.push(p(e,b,c)),a.apply(b,d),e.asObservable()}function p(a,b,c){return function(){var d=arguments[0];if(d)return a.onError(d);for(var e=arguments.length,f=[],g=1;e>g;g++)f[g-1]=arguments[g];if(E(c)){var f=I(c).apply(b,f);if(f===H)return a.onError(f.e);a.onNext(f)}else f.length<=1?a.onNext(f[0]):a.onNext(f);a.onCompleted()}}function q(b){return a.StaticNodeList?b instanceof a.StaticNodeList||b instanceof a.NodeList:"[object NodeList]"===Object.prototype.toString.call(b)}function r(a,b,c){this._e=a,this._n=b,this._fn=c,this._e.addEventListener(this._n,this._fn,!1),this.isDisposed=!1}function s(a,b,c){var d=new z,e=Object.prototype.toString.call(a);if(q(a)||"[object HTMLCollection]"===e)for(var f=0,g=a.length;g>f;f++)d.add(s(a.item(f),b,c));else a&&d.add(new r(a,b,c));return d}var t=c.Observable,u=t.fromPromise,v=t.throwError,w=c.AnonymousObservable,x=c.ObservableBase,y=c.AsyncSubject,z=(c.Disposable.create,c.CompositeDisposable),A=(c.Scheduler.immediate,c.Scheduler["default"]),B=c.internals.inherits,C=c.Scheduler.isScheduler,D=c.helpers.isPromise,E=c.helpers.isFunction,F=c.helpers.isIterable,G=c.helpers.isArrayLike,H={e:{}},I=c.internals.tryCatch=function(a){if(!E(a))throw new TypeError("fn must be a function");return e(a)};t.wrap=function(a){function b(){return t.spawn.call(this,a.apply(this,arguments))}return b.__generatorFunction__=a,b};var J=t.spawn=function(){for(var a=arguments[0],b=this,c=[],d=1,e=arguments.length;e>d;d++)c.push(arguments[d]);return new w(function(d){function e(b){var c=I(a.next).call(a,b);return c===H?d.onError(c.e):void h(c)}function g(b){var c=I(a.next).call(a,b);return c===H?d.onError(c.e):void h(c)}function h(a){if(a.done)return d.onNext(a.value),void d.onCompleted();var c=f.call(b,a.value),h=null,j=!1;t.isObservable(c)?i.add(c.subscribe(function(a){j=!0,h=a},g,function(){j&&e(h)})):g(new TypeError("type not supported"))}var i=new z;return E(a)&&(a=a.apply(b,c)),a&&E(a.next)?(e(),i):(d.onNext(a),d.onCompleted())})};t.start=function(a,b,c){return K(a,b,c)()};var K=t.toAsync=function(a,b,c){return C(c)||(c=A),function(){var d=arguments,e=new y;return c.schedule(null,function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};t.fromCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return m(a,b,c,e)}},t.fromNodeCallback=function(a,b,c){return function(){"undefined"==typeof b&&(b=this);for(var d=arguments.length,e=new Array(d),f=0;d>f;f++)e[f]=arguments[f];return o(a,b,c,e)}},r.prototype.dispose=function(){this.isDisposed||(this._e.removeEventListener(this._n,this._fn,!1),this.isDisposed=!0)},c.config.useNativeEvents=!1;var L=function(a){function b(b,c,d){this._el=b,this._n=c,this._fn=d,a.call(this)}function c(a,b){return function(){var c=arguments[0];return E(b)&&(c=I(b).apply(null,arguments),c===H)?a.onError(c.e):void a.onNext(c)}}return B(b,a),b.prototype.subscribeCore=function(a){return s(this._el,this._n,c(a,this._fn))},b}(x);t.fromEvent=function(a,b,d){return a.addListener?N(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d):c.config.useNativeEvents||"function"!=typeof a.on||"function"!=typeof a.off?new L(a,b,d).publish().refCount():N(function(c){a.on(b,c)},function(c){a.off(b,c)},d)};var M=function(a){function b(b,c,d){this._add=b,this._del=c,this._fn=d,a.call(this)}function c(a,b){return function(){var c=arguments[0];return E(b)&&(c=I(b).apply(null,arguments),c===H)?a.onError(c.e):void a.onNext(c)}}function d(a,b,c){this._del=a,this._fn=b,this._ret=c,this.isDisposed=!1}return B(b,a),b.prototype.subscribeCore=function(a){var b=c(a,this._fn),e=this._add(b);return new d(this._del,b,e)},d.prototype.dispose=function(){this.isDisposed||(E(this._del)&&this._del(this._fn,this._ret),this.isDisposed=!0)},b}(x),N=t.fromEventPattern=function(a,b,c){return new M(a,b,c).publish().refCount()};return t.startAsync=function(a){var b=I(a)();return b===H?v(b.e):u(b)},c}); | ||
//# sourceMappingURL=rx.async.map |
@@ -271,3 +271,3 @@ // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. | ||
*/ | ||
hasObservers: function () { return this.observers.length > 0; }, | ||
hasObservers: function () { checkDisposed(this); return this.observers.length > 0; }, | ||
/** | ||
@@ -390,5 +390,3 @@ * Notifies all subscribed observers about the end of the sequence. | ||
*/ | ||
hasObservers: function () { | ||
return this.observers.length > 0; | ||
}, | ||
hasObservers: function () { checkDisposed(this); return this.observers.length > 0; }, | ||
_trim: function (now) { | ||
@@ -395,0 +393,0 @@ while (this.q.length > this.bufferSize) { |
/* 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){for(var b=a.length,c=new Array(b),d=0;b>d;d++)c[d]=a[d];return c}var f=c.Observable,g=f.prototype,h=c.AnonymousObservable,i=c.ObservableBase,j=c.Subject,k=c.AsyncSubject,l=c.Observer,m=c.internals.ScheduledObserver,n=c.Disposable.create,o=c.Disposable.empty,p=c.BinaryDisposable,q=c.Scheduler.currentThread,r=c.helpers.isFunction,s=c.internals.inherits,t=c.internals.addProperties,u=c.Disposable.checkDisposed,v=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 p(this._fn2(b).subscribe(a),b.connect())},b}(i);g.multicast=function(a,b){return r(a)?new v(this,a,b):new A(this,a)},g.publish=function(a){return a&&r(a)?this.multicast(function(){return new j},a):this.multicast(new j)},g.share=function(){return this.publish().refCount()},g.publishLast=function(a){return a&&r(a)?this.multicast(function(){return new k},a):this.multicast(new k)},g.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new x(b)},a):this.multicast(new x(a))},g.shareValue=function(a){return this.publishValue(a).refCount()},g.replay=function(a,b,c,d){return a&&r(a)?this.multicast(function(){return new y(b,c,d)},a):this.multicast(new y(b,c,d))},g.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var w=function(a,b){this._s=a,this._o=b};w.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 x=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,l.prototype,{_subscribe:function(a){return u(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),o):(this.observers.push(a),a.onNext(this.value),new w(this,a))},getValue:function(){return u(this),this.hasError&&thrower(this.error),this.value},hasObservers:function(){return 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}(f),y=c.ReplaySubject=function(a){function b(a,b){return n(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,l.prototype,{_subscribe:function(a){u(this);var c=new m(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 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}(f),z=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}(i),A=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){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 z(this)},b}(f);return g.singleInstance=function(){function a(){return d||(d=!0,b=c["finally"](function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new h(function(b){return a().subscribe(b)})},c}); | ||
(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){for(var b=a.length,c=new Array(b),d=0;b>d;d++)c[d]=a[d];return c}var f=c.Observable,g=f.prototype,h=c.AnonymousObservable,i=c.ObservableBase,j=c.Subject,k=c.AsyncSubject,l=c.Observer,m=c.internals.ScheduledObserver,n=c.Disposable.create,o=c.Disposable.empty,p=c.BinaryDisposable,q=c.Scheduler.currentThread,r=c.helpers.isFunction,s=c.internals.inherits,t=c.internals.addProperties,u=c.Disposable.checkDisposed,v=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 p(this._fn2(b).subscribe(a),b.connect())},b}(i);g.multicast=function(a,b){return r(a)?new v(this,a,b):new A(this,a)},g.publish=function(a){return a&&r(a)?this.multicast(function(){return new j},a):this.multicast(new j)},g.share=function(){return this.publish().refCount()},g.publishLast=function(a){return a&&r(a)?this.multicast(function(){return new k},a):this.multicast(new k)},g.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new x(b)},a):this.multicast(new x(a))},g.shareValue=function(a){return this.publishValue(a).refCount()},g.replay=function(a,b,c,d){return a&&r(a)?this.multicast(function(){return new y(b,c,d)},a):this.multicast(new y(b,c,d))},g.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var w=function(a,b){this._s=a,this._o=b};w.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 x=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,l.prototype,{_subscribe:function(a){return u(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),o):(this.observers.push(a),a.onNext(this.value),new w(this,a))},getValue:function(){return u(this),this.hasError&&thrower(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}(f),y=c.ReplaySubject=function(a){function b(a,b){return n(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,l.prototype,{_subscribe:function(a){u(this);var c=new m(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}(f),z=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}(i),A=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){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 z(this)},b}(f);return g.singleInstance=function(){function a(){return d||(d=!0,b=c["finally"](function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new h(function(b){return a().subscribe(b)})},c}); | ||
//# sourceMappingURL=rx.binding.map |
@@ -440,2 +440,3 @@ // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. | ||
this._hp = false; | ||
__super__.call(this); | ||
} | ||
@@ -442,0 +443,0 @@ |
/* 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 D.e=b,D}}}function f(a){return a.toArray()}function g(a,b){return a.groupJoin(this,b,t,function(a,b){return b})}function h(a){var b=this;return new v(function(c){var d=new r,e=new m,f=new o(e);return c.onNext(w(d,f)),e.add(b.subscribe(function(a){d.onNext(a)},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),A(a)&&(a=C(a)),e.add(a.subscribe(function(a){d.onCompleted(),d=new r,c.onNext(w(d,f))},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),f},b)}function i(a){var b=this;return new v(function(c){function d(){var b;try{b=a()}catch(f){return void c.onError(f)}A(b)&&(b=C(b));var i=new p;e.setDisposable(i),i.setDisposable(b.take(1).subscribe(z,function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),h=new r,c.onNext(w(h,g)),d()}))}var e=new q,f=new m(e),g=new o(f),h=new r;return c.onNext(w(h,g)),f.add(b.subscribe(function(a){h.onNext(a)},function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),c.onCompleted()})),d(),g},b)}var j=c.Observable,k=c.ObservableBase,l=c.internals.AbstractObserver,m=c.CompositeDisposable,n=c.BinaryDisposable,o=c.RefCountDisposable,p=c.SingleAssignmentDisposable,q=c.SerialDisposable,r=c.Subject,s=j.prototype,t=j.empty,u=j.never,v=c.AnonymousObservable,w=c.internals.addRef,x=c.internals.inherits,y=c.internals.bindCallback,z=c.helpers.noop,A=c.helpers.isPromise,B=c.helpers.isFunction,C=j.fromPromise,D={e:{}},E=c.internals.tryCatch=function(a){if(!B(a))throw new TypeError("fn must be a function");return e(a)},F=a.Map||function(){function a(){this.size=0,this._values=[],this._keys=[]}return a.prototype["delete"]=function(a){var b=this._keys.indexOf(a);return-1===b?!1:(this._values.splice(b,1),this._keys.splice(b,1),this.size--,!0)},a.prototype.get=function(a){var b=this._keys.indexOf(a);return-1===b?d:this._values[b]},a.prototype.set=function(a,b){var c=this._keys.indexOf(a);return-1===c?(this._keys.push(a),this._values.push(b),this.size++):this._values[c]=b,this},a.prototype.forEach=function(a,b){for(var c=0;c<this.size;c++)a.call(b,this._values[c],this._keys[c])},a}();s.join=function(a,b,c,d){var e=this;return new v(function(f){var g=new m,h=!1,i=!1,j=0,k=0,l=new F,n=new F,o=function(a){f.onError(a)};return g.add(e.subscribe(function(a){var c=j++,e=new p;l.set(c,a),g.add(e);var i=E(b)(a);return i===D?f.onError(i.e):(e.setDisposable(i.take(1).subscribe(z,o,function(){l["delete"](c)&&0===l.size&&h&&f.onCompleted(),g.remove(e)})),void n.forEach(function(b){var c=E(d)(a,b);return c===D?f.onError(c.e):void f.onNext(c)}))},o,function(){h=!0,(i||0===l.size)&&f.onCompleted()})),g.add(a.subscribe(function(a){var b=k++,e=new p;n.set(b,a),g.add(e);var h=E(c)(a);return h===D?f.onError(h.e):(e.setDisposable(h.take(1).subscribe(z,o,function(){n["delete"](b)&&0===n.size&&i&&f.onCompleted(),g.remove(e)})),void l.forEach(function(b){var c=E(d)(b,a);return c===D?f.onError(c.e):void f.onNext(c)}))},o,function(){i=!0,(h||0===n.size)&&f.onCompleted()})),g},e)},s.groupJoin=function(a,b,c,d){var e=this;return new v(function(f){function g(a){}var h=new m,i=new o(h),j=new F,k=new F,l=0,n=0,g=function(a){return function(b){b.onError(a)}};return h.add(e.subscribe(function(a){var c=new r,e=l++;j.set(e,c);var m=E(d)(a,w(c,i));if(m===D)return j.forEach(g(m.e)),f.onError(m.e);f.onNext(m),k.forEach(function(a){c.onNext(a)});var n=new p;h.add(n);var o=E(b)(a);return o===D?(j.forEach(g(o.e)),f.onError(o.e)):void n.setDisposable(o.take(1).subscribe(z,function(a){j.forEach(g(a)),f.onError(a)},function(){j["delete"](e)&&c.onCompleted(),h.remove(n)}))},function(a){j.forEach(g(a)),f.onError(a)},function(){f.onCompleted()})),h.add(a.subscribe(function(a){var b=n++;k.set(b,a);var d=new p;h.add(d);var e=E(c)(a);return e===D?(j.forEach(g(e.e)),f.onError(e.e)):(d.setDisposable(e.take(1).subscribe(z,function(a){j.forEach(g(a)),f.onError(a)},function(){k["delete"](b),h.remove(d)})),void j.forEach(function(b){b.onNext(a)}))},function(a){j.forEach(g(a)),f.onError(a)})),i},e)},s.buffer=function(){return this.window.apply(this,arguments).flatMap(f)},s.window=function(a,b){return 1===arguments.length&&"function"!=typeof arguments[0]?h.call(this,a):"function"==typeof a?i.call(this,a):g.call(this,a,b)};var G=function(a){function b(b){this.source=b,a.call(this)}return x(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new H(a))},b}(k),H=function(a){function b(a){this._o=a,this._p=null,this._hp=!1}return x(b,a),b.prototype.next=function(a){this._hp?this._o.onNext([this._p,a]):this._hp=!0,this._p=a},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(l);s.pairwise=function(){return new G(this)},s.partition=function(a,b){var c=y(a,b,3);return[this.filter(a,b),this.filter(function(a,b,d){return!c(a,b,d)})]},s.groupBy=function(a,b){return this.groupByUntil(a,b,u)},s.groupByUntil=function(a,b,c){var e=this;return new v(function(f){var g=new F,h=new m,i=new o(h),j=function(a){return function(b){b.onError(a)}};return h.add(e.subscribe(function(e){var k=E(a)(e);if(k===D)return g.forEach(j(k.e)),f.onError(k.e);var l=!1,m=g.get(k);if(m===d&&(m=new r,g.set(k,m),l=!0),l){var n=new J(k,m,i),o=new J(k,m),q=E(c)(o);if(q===D)return g.forEach(j(q.e)),f.onError(q.e);f.onNext(n);var s=new p;h.add(s),s.setDisposable(q.take(1).subscribe(z,function(a){g.forEach(j(a)),f.onError(a)},function(){g["delete"](k)&&m.onCompleted(),h.remove(s)}))}var t=e;return B(b)&&(t=E(b)(e),t===D)?(g.forEach(j(t.e)),f.onError(t.e)):void m.onNext(t)},function(a){g.forEach(j(a)),f.onError(a)},function(){g.forEach(function(a){a.onCompleted()}),f.onCompleted()})),i},e)};var I=function(a){function b(b,c){this._m=b,this._u=c,a.call(this)}return x(b,a),b.prototype.subscribeCore=function(a){return new n(this._m.getDisposable(),this._u.subscribe(a))},b}(k),J=function(a){function b(b,c,d){a.call(this),this.key=b,this.underlyingObservable=d?new I(d,c):c}return x(b,a),b.prototype._subscribe=function(a){return this.underlyingObservable.subscribe(a)},b}(j);return c}); | ||
(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 D.e=b,D}}}function f(a){return a.toArray()}function g(a,b){return a.groupJoin(this,b,t,function(a,b){return b})}function h(a){var b=this;return new v(function(c){var d=new r,e=new m,f=new o(e);return c.onNext(w(d,f)),e.add(b.subscribe(function(a){d.onNext(a)},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),A(a)&&(a=C(a)),e.add(a.subscribe(function(a){d.onCompleted(),d=new r,c.onNext(w(d,f))},function(a){d.onError(a),c.onError(a)},function(){d.onCompleted(),c.onCompleted()})),f},b)}function i(a){var b=this;return new v(function(c){function d(){var b;try{b=a()}catch(f){return void c.onError(f)}A(b)&&(b=C(b));var i=new p;e.setDisposable(i),i.setDisposable(b.take(1).subscribe(z,function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),h=new r,c.onNext(w(h,g)),d()}))}var e=new q,f=new m(e),g=new o(f),h=new r;return c.onNext(w(h,g)),f.add(b.subscribe(function(a){h.onNext(a)},function(a){h.onError(a),c.onError(a)},function(){h.onCompleted(),c.onCompleted()})),d(),g},b)}var j=c.Observable,k=c.ObservableBase,l=c.internals.AbstractObserver,m=c.CompositeDisposable,n=c.BinaryDisposable,o=c.RefCountDisposable,p=c.SingleAssignmentDisposable,q=c.SerialDisposable,r=c.Subject,s=j.prototype,t=j.empty,u=j.never,v=c.AnonymousObservable,w=c.internals.addRef,x=c.internals.inherits,y=c.internals.bindCallback,z=c.helpers.noop,A=c.helpers.isPromise,B=c.helpers.isFunction,C=j.fromPromise,D={e:{}},E=c.internals.tryCatch=function(a){if(!B(a))throw new TypeError("fn must be a function");return e(a)},F=a.Map||function(){function a(){this.size=0,this._values=[],this._keys=[]}return a.prototype["delete"]=function(a){var b=this._keys.indexOf(a);return-1===b?!1:(this._values.splice(b,1),this._keys.splice(b,1),this.size--,!0)},a.prototype.get=function(a){var b=this._keys.indexOf(a);return-1===b?d:this._values[b]},a.prototype.set=function(a,b){var c=this._keys.indexOf(a);return-1===c?(this._keys.push(a),this._values.push(b),this.size++):this._values[c]=b,this},a.prototype.forEach=function(a,b){for(var c=0;c<this.size;c++)a.call(b,this._values[c],this._keys[c])},a}();s.join=function(a,b,c,d){var e=this;return new v(function(f){var g=new m,h=!1,i=!1,j=0,k=0,l=new F,n=new F,o=function(a){f.onError(a)};return g.add(e.subscribe(function(a){var c=j++,e=new p;l.set(c,a),g.add(e);var i=E(b)(a);return i===D?f.onError(i.e):(e.setDisposable(i.take(1).subscribe(z,o,function(){l["delete"](c)&&0===l.size&&h&&f.onCompleted(),g.remove(e)})),void n.forEach(function(b){var c=E(d)(a,b);return c===D?f.onError(c.e):void f.onNext(c)}))},o,function(){h=!0,(i||0===l.size)&&f.onCompleted()})),g.add(a.subscribe(function(a){var b=k++,e=new p;n.set(b,a),g.add(e);var h=E(c)(a);return h===D?f.onError(h.e):(e.setDisposable(h.take(1).subscribe(z,o,function(){n["delete"](b)&&0===n.size&&i&&f.onCompleted(),g.remove(e)})),void l.forEach(function(b){var c=E(d)(b,a);return c===D?f.onError(c.e):void f.onNext(c)}))},o,function(){i=!0,(h||0===n.size)&&f.onCompleted()})),g},e)},s.groupJoin=function(a,b,c,d){var e=this;return new v(function(f){function g(a){}var h=new m,i=new o(h),j=new F,k=new F,l=0,n=0,g=function(a){return function(b){b.onError(a)}};return h.add(e.subscribe(function(a){var c=new r,e=l++;j.set(e,c);var m=E(d)(a,w(c,i));if(m===D)return j.forEach(g(m.e)),f.onError(m.e);f.onNext(m),k.forEach(function(a){c.onNext(a)});var n=new p;h.add(n);var o=E(b)(a);return o===D?(j.forEach(g(o.e)),f.onError(o.e)):void n.setDisposable(o.take(1).subscribe(z,function(a){j.forEach(g(a)),f.onError(a)},function(){j["delete"](e)&&c.onCompleted(),h.remove(n)}))},function(a){j.forEach(g(a)),f.onError(a)},function(){f.onCompleted()})),h.add(a.subscribe(function(a){var b=n++;k.set(b,a);var d=new p;h.add(d);var e=E(c)(a);return e===D?(j.forEach(g(e.e)),f.onError(e.e)):(d.setDisposable(e.take(1).subscribe(z,function(a){j.forEach(g(a)),f.onError(a)},function(){k["delete"](b),h.remove(d)})),void j.forEach(function(b){b.onNext(a)}))},function(a){j.forEach(g(a)),f.onError(a)})),i},e)},s.buffer=function(){return this.window.apply(this,arguments).flatMap(f)},s.window=function(a,b){return 1===arguments.length&&"function"!=typeof arguments[0]?h.call(this,a):"function"==typeof a?i.call(this,a):g.call(this,a,b)};var G=function(a){function b(b){this.source=b,a.call(this)}return x(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new H(a))},b}(k),H=function(a){function b(b){this._o=b,this._p=null,this._hp=!1,a.call(this)}return x(b,a),b.prototype.next=function(a){this._hp?this._o.onNext([this._p,a]):this._hp=!0,this._p=a},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(l);s.pairwise=function(){return new G(this)},s.partition=function(a,b){var c=y(a,b,3);return[this.filter(a,b),this.filter(function(a,b,d){return!c(a,b,d)})]},s.groupBy=function(a,b){return this.groupByUntil(a,b,u)},s.groupByUntil=function(a,b,c){var e=this;return new v(function(f){var g=new F,h=new m,i=new o(h),j=function(a){return function(b){b.onError(a)}};return h.add(e.subscribe(function(e){var k=E(a)(e);if(k===D)return g.forEach(j(k.e)),f.onError(k.e);var l=!1,m=g.get(k);if(m===d&&(m=new r,g.set(k,m),l=!0),l){var n=new J(k,m,i),o=new J(k,m),q=E(c)(o);if(q===D)return g.forEach(j(q.e)),f.onError(q.e);f.onNext(n);var s=new p;h.add(s),s.setDisposable(q.take(1).subscribe(z,function(a){g.forEach(j(a)),f.onError(a)},function(){g["delete"](k)&&m.onCompleted(),h.remove(s)}))}var t=e;return B(b)&&(t=E(b)(e),t===D)?(g.forEach(j(t.e)),f.onError(t.e)):void m.onNext(t)},function(a){g.forEach(j(a)),f.onError(a)},function(){g.forEach(function(a){a.onCompleted()}),f.onCompleted()})),i},e)};var I=function(a){function b(b,c){this._m=b,this._u=c,a.call(this)}return x(b,a),b.prototype.subscribeCore=function(a){return new n(this._m.getDisposable(),this._u.subscribe(a))},b}(k),J=function(a){function b(b,c,d){a.call(this),this.key=b,this.underlyingObservable=d?new I(d,c):c}return x(b,a),b.prototype._subscribe=function(a){return this.underlyingObservable.subscribe(a)},b}(j);return c}); | ||
//# sourceMappingURL=rx.coincidence.map |
@@ -344,3 +344,3 @@ // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. | ||
*/ | ||
hasObservers: function () { return this.observers.length > 0; }, | ||
hasObservers: function () { checkDisposed(this); return this.observers.length > 0; }, | ||
/** | ||
@@ -481,6 +481,3 @@ * Notifies all subscribed observers about the end of the sequence. | ||
*/ | ||
hasObservers: function () { | ||
checkDisposed(this); | ||
return this.observers.length > 0; | ||
}, | ||
hasObservers: function () { checkDisposed(this); return this.observers.length > 0; }, | ||
/** | ||
@@ -599,3 +596,3 @@ * Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any). | ||
*/ | ||
hasObservers: function () { return this.observers.length > 0; }, | ||
hasObservers: function () { checkDisposed(this); return this.observers.length > 0; }, | ||
/** | ||
@@ -718,5 +715,3 @@ * Notifies all subscribed observers about the end of the sequence. | ||
*/ | ||
hasObservers: function () { | ||
return this.observers.length > 0; | ||
}, | ||
hasObservers: function () { checkDisposed(this); return this.observers.length > 0; }, | ||
_trim: function (now) { | ||
@@ -723,0 +718,0 @@ while (this.q.length > this.bufferSize) { |
/* 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 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 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 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){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}); | ||
(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){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 |
@@ -788,3 +788,3 @@ // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. | ||
tasksByHandle[id] = action; | ||
root.postMessage(MSG_PREFIX + currentId, '*'); | ||
root.postMessage(MSG_PREFIX + id, '*'); | ||
return id; | ||
@@ -791,0 +791,0 @@ }; |
/* 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}function c(a){return function(){try{return a.apply(this,arguments)}catch(b){return C.e=b,C}}}function d(a){throw a}function e(a,b){if(E&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(I)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var e=c.join("\n"+I+"\n");a.stack=f(e)}}function f(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var f=b[d];g(f)||h(f)||!f||c.push(f)}return c.join("\n")}function g(a){var b=j(a);if(!b)return!1;var c=b[0],d=b[1];return c===G&&d>=H&&pa>=d}function h(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function i(){if(E)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=j(c);if(!d)return;return G=d[0],d[1]}}function j(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function k(a,b){this.id=a,this.value=b}var l={"function":!0,object:!0},m=l[typeof exports]&&exports&&!exports.nodeType?exports:null,n=l[typeof module]&&module&&!module.nodeType?module:null,o=b(m&&n&&"object"==typeof global&&global),p=b(l[typeof self]&&self),q=b(l[typeof window]&&window),r=n&&n.exports===m?m:null,s=b(l[typeof this]&&this),t=o||q!==(s&&s.window)&&q||p||s||Function("return this")(),u={internals:{},config:{Promise:t.Promise},helpers:{}},v=u.helpers.noop=function(){},w=u.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}(),x=u.helpers.defaultError=function(a){throw a},y=(u.helpers.isPromise=function(a){return!!a&&!isFunction(a.subscribe)&&isFunction(a.then)},u.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0});isFunction=u.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==toString.call(a)}),a}();var z=u.NotImplementedError=function(a){this.message=a||"This operation is not implemented",Error.call(this)};z.prototype=Error.prototype;var A=u.NotSupportedError=function(a){this.message=a||"This operation is not supported",Error.call(this)};A.prototype=Error.prototype;var B=u.helpers.notImplemented=function(){throw new z},C=(u.helpers.notSupported=function(){throw new A},{e:{}}),D=u.internals.tryCatch=function(a){if(!isFunction(a))throw new TypeError("fn must be a function");return c(a)};u.config.longStackSupport=!1;var E=!1,F=D(function(){throw new Error})();E=!!F.e&&!!F.e.stack;var G,H=i(),I="From previous event:",J=({}.hasOwnProperty,Array.prototype.slice,u.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),K=(u.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}},u.internals.addRef=function(a,b){return new na(function(c){return new T(b.getDisposable(),a.subscribe(c))})},u.CompositeDisposable=function(){var a,b,c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(b=arguments.length,c=new Array(b),a=0;b>a;a++)c[a]=arguments[a];this.disposables=c,this.isDisposed=!1,this.length=c.length}),L=K.prototype;L.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},L.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},L.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=this.disposables.length,b=new Array(a),c=0;a>c;c++)b[c]=this.disposables[c];for(this.disposables=[],this.length=0,c=0;a>c;c++)b[c].dispose()}};var M=u.Disposable=function(a){this.isDisposed=!1,this.action=a||v};M.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var N=M.create=function(a){return new M(a)},O=M.empty={dispose:v},P=M.isDisposable=function(a){return a&&isFunction(a.dispose)},Q=(M.checkDisposed=function(a){if(a.isDisposed)throw new ObjectDisposedError},M._fixup=function(a){return P(a)?a:O}),R=u.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};R.prototype.getDisposable=function(){return this.current},R.prototype.setDisposable=function(a){if(this.current)throw new Error("Disposable has already been assigned");var b=this.isDisposed;!b&&(this.current=a),b&&a&&a.dispose()},R.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null,a&&a.dispose()}};var S=u.SerialDisposable=function(){this.isDisposed=!1,this.current=null};S.prototype.getDisposable=function(){return this.current},S.prototype.setDisposable=function(a){var b=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},S.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var T=u.BinaryDisposable=function(a,b){this._first=a,this._second=b,this.isDisposed=!1};T.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this._first;this._first=null,a&&a.dispose();var b=this._second;this._second=null,b&&b.dispose()}};var U=u.NAryDisposable=function(a){this._disposables=a,this.isDisposed=!1};U.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=0,b=this._disposables.length;b>a;a++)this._disposables[a].dispose();this._disposables.length=0}};var V=u.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||y,this.disposable=new R};V.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},V.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},V.prototype.isCancelled=function(){return this.disposable.isDisposed},V.prototype.invokeCore=function(){return Q(this.action(this.scheduler,this.state))};var W=u.Scheduler=function(){function a(){}a.isScheduler=function(b){return b instanceof a};var b=a.prototype;return b.schedule=function(a,b){throw new z},b.scheduleFuture=function(b,c,d){var e=c;return e instanceof Date&&(e-=this.now()),e=a.normalize(e),0===e?this.schedule(b,d):this._scheduleFuture(b,e,d)},b._scheduleFuture=function(a,b,c){throw new z},a.now=w,a.prototype.now=w,a.normalize=function(a){return 0>a&&(a=0),a},a}(),X=W.normalize;W.isScheduler;!function(a){function b(a,b){function c(b){function d(a,b){return g?f.remove(i):h=!0,e(b,c),O}var g=!1,h=!1,i=a.schedule(b,d);h||(f.add(i),g=!0)}var d=b[0],e=b[1],f=new K;return e(d,c),f}function c(a,b){function c(b,d){function g(a,b){return h?f.remove(j):i=!0,e(b,c),O}var h=!1,i=!1,j=a.scheduleFuture(b,d,g);i||(f.add(j),h=!0)}var d=b[0],e=b[1],f=new K;return e(d,c),f}a.scheduleRecursive=function(a,c){return this.schedule([a,c],b)},a.scheduleRecursiveFuture=function(a,b,d){return this.scheduleFuture([a,d],b,c)}}(W.prototype),function(a){a.schedulePeriodic=function(a,b,c){if("undefined"==typeof t.setInterval)throw new A;b=X(b);var d=a,e=t.setInterval(function(){d=c(d)},b);return N(function(){t.clearInterval(e)})}}(W.prototype);var Y,Z,$=(u.internals.SchedulePeriodicRecursive=function(){function a(a){return function(b,c){c(0,a._period);var e=D(a._action)(a._state);e===C&&(a._cancel.dispose(),d(e.e)),a._state=e}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new R;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveFuture(0,this._period,a(this))),b},b}(),function(a){function b(){a.call(this)}return J(b,a),b.prototype.schedule=function(a,b){return Q(b(this,a))},b}(W)),_=(W.immediate=new $,function(a){function b(){for(;e.length>0;){var a=e.dequeue();!a.isCancelled()&&a.invoke()}}function c(){a.call(this)}var e;return J(c,a),c.prototype.schedule=function(a,c){var f=new V(this,a,c,this.now());if(e)e.enqueue(f);else{e=new fa(4),e.enqueue(f);var g=D(b)();e=null,g===C&&d(g.e)}return f.disposable},c.prototype.scheduleRequired=function(){return!e},c}(W)),aa=W.currentThread=new _,ba=function(){var a,b=v;if(t.setTimeout)a=t.setTimeout,b=t.clearTimeout;else{if(!t.WScript)throw new A;a=function(a,b){t.WScript.Sleep(b),a()}}return{setTimeout:a,clearTimeout:b}}(),ca=ba.setTimeout,da=ba.clearTimeout;!function(){function a(b){if(f)ca(function(){a(b)},0);else{var c=e[b];if(c){f=!0;var g=D(c)();Z(b),f=!1,g===C&&d(g.e)}}}function b(){if(!t.postMessage||t.importScripts)return!1;var a=!1,b=t.onmessage;return t.onmessage=function(){a=!0},t.postMessage("","*"),t.onmessage=b,a}var c=1,e={},f=!1;Z=function(a){delete e[a]};var g=new RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),h="function"==typeof(h=o&&r&&o.setImmediate)&&!g.test(h)&&h;if(isFunction(h))Y=function(b){var d=c++;return e[d]=b,h(function(){a(d)}),d};else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Y=function(b){var d=c++;return e[d]=b,process.nextTick(function(){a(d)}),d};else if(b()){var i="ms.rx.schedule"+Math.random(),j=function(b){"string"==typeof b.data&&b.data.substring(0,i.length)===i&&a(b.data.substring(i.length))};t.addEventListener("message",j,!1),Y=function(a){var b=c++;return e[b]=a,t.postMessage(i+currentId,"*"),b}}else if(t.MessageChannel){var k=new t.MessageChannel;k.port1.onmessage=function(b){a(b.data)},Y=function(a){var b=c++;return e[b]=a,k.port2.postMessage(b),b}}else Y="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(b){var d=t.document.createElement("script"),f=c++;return e[f]=b,d.onreadystatechange=function(){a(f),d.onreadystatechange=null,d.parentNode.removeChild(d),d=null},t.document.documentElement.appendChild(d),f}:function(b){var d=c++;return e[d]=b,ca(function(){a(d)},0),d}}();var ea=function(a){function b(){a.call(this)}function c(a,b,c,d){return function(){a.setDisposable(M._fixup(b(c,d)))}}function d(a){this._id=a,this.isDisposed=!1}function e(a){this._id=a,this.isDisposed=!1}return J(b,a),d.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,Z(this._id))},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,da(this._id))},b.prototype.schedule=function(a,b){var e=new R,f=Y(c(e,b,this,a));return new T(e,new d(f))},b.prototype._scheduleFuture=function(a,b,d){if(0===b)return this.schedule(a,d);var f=new R,g=ca(c(f,d,this,a),b);return new T(f,new e(g))},b}(W);W["default"]=W.async=new ea;k.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var fa=u.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},ga=fa.prototype;ga.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},ga.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},ga.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},ga.peek=function(){return this.items[0].value},ga.removeAt=function(b){this.items[b]=this.items[--this.length],this.items[this.length]=a,this.heapify()},ga.dequeue=function(){var a=this.peek();return this.removeAt(0),a},ga.enqueue=function(a){var b=this.length++;this.items[b]=new k(fa.count++,a),this.percolate(b)},ga.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},fa.count=0;var ha,ia=u.Observer=function(){},ja=ia.create=function(a,b,c){return a||(a=v),b||(b=x),c||(c=v),new la(a,b,c)},ka=u.internals.AbstractObserver=function(a){function b(){this.isStopped=!1}return J(b,a),b.prototype.next=B,b.prototype.error=B,b.prototype.completed=B,b.prototype.onNext=function(a){!this.isStopped&&this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(ia),la=u.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return J(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(ka),ma=u.Observable=function(){function a(a,b){return function(c){var d=c.onError;return c.onError=function(b){e(b,a),d.call(c,b)},b.call(a,c)}}function b(){if(u.config.longStackSupport&&E){var b=this._subscribe,c=D(d)(new Error).e;this.stack=c.stack.substring(c.stack.indexOf("\n")+1),this._subscribe=a(this,b)}}return ha=b.prototype,b.isObservable=function(a){return a&&isFunction(a.subscribe)},ha.subscribe=ha.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:ja(a,b,c))},ha.subscribeOnNext=function(a,b){return this._subscribe(ja("undefined"!=typeof b?function(c){a.call(b,c)}:a))},ha.subscribeOnError=function(a,b){return this._subscribe(ja(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},ha.subscribeOnCompleted=function(a,b){return this._subscribe(ja(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},b}(),na=u.AnonymousObservable=function(a){function b(a){return a&&isFunction(a.dispose)?a:isFunction(a)?N(a):O}function c(a,c){var e=c[0],f=c[1],g=D(f.__subscribe).call(f,e);g!==C||e.fail(C.e)||d(C.e),e.setDisposable(b(g))}function e(b,c){this.source=c,this.__subscribe=b,a.call(this)}return J(e,a),e.prototype._subscribe=function(a){var b=new oa(a),d=[b,this];return aa.scheduleRequired()?aa.schedule(d,c):c(null,d),b},e}(ma),oa=(u.ObservableBase=function(a){function b(a){return a&&isFunction(a.dispose)?a:isFunction(a)?N(a):O}function c(a,c){var e=c[0],f=c[1],g=D(f.subscribeCore).call(f,e);g!==C||e.fail(C.e)||d(C.e),e.setDisposable(b(g))}function e(){a.call(this)}return J(e,a),e.prototype._subscribe=function(a){var b=new oa(a),d=[b,this];return aa.scheduleRequired()?aa.schedule(d,c):c(null,d),b},e.prototype.subscribeCore=B,e}(ma),function(a){function b(b){a.call(this),this.observer=b,this.m=new R}J(b,a);var c=b.prototype;return c.next=function(a){var b=D(this.observer.onNext).call(this.observer,a);b===C&&(this.dispose(),d(b.e))},c.error=function(a){var b=D(this.observer.onError).call(this.observer,a);this.dispose(),b===C&&d(b.e)},c.completed=function(){var a=D(this.observer.onCompleted).call(this.observer);this.dispose(),a===C&&d(a.e)},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(ka));ma.create=function(a,b){return new na(a,b)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=u,define(function(){return u})):m&&n?r?(n.exports=u).Rx=u:m.Rx=u:t.Rx=u;var pa=i()}).call(this); | ||
(function(a){function b(a){return a&&a.Object===Object?a:null}function c(a){return function(){try{return a.apply(this,arguments)}catch(b){return C.e=b,C}}}function d(a){throw a}function e(a,b){if(E&&b.stack&&"object"==typeof a&&null!==a&&a.stack&&-1===a.stack.indexOf(I)){for(var c=[],d=b;d;d=d.source)d.stack&&c.unshift(d.stack);c.unshift(a.stack);var e=c.join("\n"+I+"\n");a.stack=f(e)}}function f(a){for(var b=a.split("\n"),c=[],d=0,e=b.length;e>d;d++){var f=b[d];g(f)||h(f)||!f||c.push(f)}return c.join("\n")}function g(a){var b=j(a);if(!b)return!1;var c=b[0],d=b[1];return c===G&&d>=H&&pa>=d}function h(a){return-1!==a.indexOf("(module.js:")||-1!==a.indexOf("(node.js:")}function i(){if(E)try{throw new Error}catch(a){var b=a.stack.split("\n"),c=b[0].indexOf("@")>0?b[1]:b[2],d=j(c);if(!d)return;return G=d[0],d[1]}}function j(a){var b=/at .+ \((.+):(\d+):(?:\d+)\)$/.exec(a);if(b)return[b[1],Number(b[2])];var c=/at ([^ ]+):(\d+):(?:\d+)$/.exec(a);if(c)return[c[1],Number(c[2])];var d=/.*@(.+):(\d+)$/.exec(a);return d?[d[1],Number(d[2])]:void 0}function k(a,b){this.id=a,this.value=b}var l={"function":!0,object:!0},m=l[typeof exports]&&exports&&!exports.nodeType?exports:null,n=l[typeof module]&&module&&!module.nodeType?module:null,o=b(m&&n&&"object"==typeof global&&global),p=b(l[typeof self]&&self),q=b(l[typeof window]&&window),r=n&&n.exports===m?m:null,s=b(l[typeof this]&&this),t=o||q!==(s&&s.window)&&q||p||s||Function("return this")(),u={internals:{},config:{Promise:t.Promise},helpers:{}},v=u.helpers.noop=function(){},w=u.helpers.defaultNow=function(){return Date.now?Date.now:function(){return+new Date}}(),x=u.helpers.defaultError=function(a){throw a},y=(u.helpers.isPromise=function(a){return!!a&&!isFunction(a.subscribe)&&isFunction(a.then)},u.helpers.defaultSubComparer=function(a,b){return a>b?1:b>a?-1:0});isFunction=u.helpers.isFunction=function(){var a=function(a){return"function"==typeof a||!1};return a(/x/)&&(a=function(a){return"function"==typeof a&&"[object Function]"==toString.call(a)}),a}();var z=u.NotImplementedError=function(a){this.message=a||"This operation is not implemented",Error.call(this)};z.prototype=Error.prototype;var A=u.NotSupportedError=function(a){this.message=a||"This operation is not supported",Error.call(this)};A.prototype=Error.prototype;var B=u.helpers.notImplemented=function(){throw new z},C=(u.helpers.notSupported=function(){throw new A},{e:{}}),D=u.internals.tryCatch=function(a){if(!isFunction(a))throw new TypeError("fn must be a function");return c(a)};u.config.longStackSupport=!1;var E=!1,F=D(function(){throw new Error})();E=!!F.e&&!!F.e.stack;var G,H=i(),I="From previous event:",J=({}.hasOwnProperty,Array.prototype.slice,u.internals.inherits=function(a,b){function c(){this.constructor=a}c.prototype=b.prototype,a.prototype=new c}),K=(u.internals.addProperties=function(a){for(var b=[],c=1,d=arguments.length;d>c;c++)b.push(arguments[c]);for(var e=0,f=b.length;f>e;e++){var g=b[e];for(var h in g)a[h]=g[h]}},u.internals.addRef=function(a,b){return new na(function(c){return new T(b.getDisposable(),a.subscribe(c))})},u.CompositeDisposable=function(){var a,b,c=[];if(Array.isArray(arguments[0]))c=arguments[0];else for(b=arguments.length,c=new Array(b),a=0;b>a;a++)c[a]=arguments[a];this.disposables=c,this.isDisposed=!1,this.length=c.length}),L=K.prototype;L.add=function(a){this.isDisposed?a.dispose():(this.disposables.push(a),this.length++)},L.remove=function(a){var b=!1;if(!this.isDisposed){var c=this.disposables.indexOf(a);-1!==c&&(b=!0,this.disposables.splice(c,1),this.length--,a.dispose())}return b},L.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=this.disposables.length,b=new Array(a),c=0;a>c;c++)b[c]=this.disposables[c];for(this.disposables=[],this.length=0,c=0;a>c;c++)b[c].dispose()}};var M=u.Disposable=function(a){this.isDisposed=!1,this.action=a||v};M.prototype.dispose=function(){this.isDisposed||(this.action(),this.isDisposed=!0)};var N=M.create=function(a){return new M(a)},O=M.empty={dispose:v},P=M.isDisposable=function(a){return a&&isFunction(a.dispose)},Q=(M.checkDisposed=function(a){if(a.isDisposed)throw new ObjectDisposedError},M._fixup=function(a){return P(a)?a:O}),R=u.SingleAssignmentDisposable=function(){this.isDisposed=!1,this.current=null};R.prototype.getDisposable=function(){return this.current},R.prototype.setDisposable=function(a){if(this.current)throw new Error("Disposable has already been assigned");var b=this.isDisposed;!b&&(this.current=a),b&&a&&a.dispose()},R.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null,a&&a.dispose()}};var S=u.SerialDisposable=function(){this.isDisposed=!1,this.current=null};S.prototype.getDisposable=function(){return this.current},S.prototype.setDisposable=function(a){var b=this.isDisposed;if(!b){var c=this.current;this.current=a}c&&c.dispose(),b&&a&&a.dispose()},S.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this.current;this.current=null}a&&a.dispose()};var T=u.BinaryDisposable=function(a,b){this._first=a,this._second=b,this.isDisposed=!1};T.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;var a=this._first;this._first=null,a&&a.dispose();var b=this._second;this._second=null,b&&b.dispose()}};var U=u.NAryDisposable=function(a){this._disposables=a,this.isDisposed=!1};U.prototype.dispose=function(){if(!this.isDisposed){this.isDisposed=!0;for(var a=0,b=this._disposables.length;b>a;a++)this._disposables[a].dispose();this._disposables.length=0}};var V=u.internals.ScheduledItem=function(a,b,c,d,e){this.scheduler=a,this.state=b,this.action=c,this.dueTime=d,this.comparer=e||y,this.disposable=new R};V.prototype.invoke=function(){this.disposable.setDisposable(this.invokeCore())},V.prototype.compareTo=function(a){return this.comparer(this.dueTime,a.dueTime)},V.prototype.isCancelled=function(){return this.disposable.isDisposed},V.prototype.invokeCore=function(){return Q(this.action(this.scheduler,this.state))};var W=u.Scheduler=function(){function a(){}a.isScheduler=function(b){return b instanceof a};var b=a.prototype;return b.schedule=function(a,b){throw new z},b.scheduleFuture=function(b,c,d){var e=c;return e instanceof Date&&(e-=this.now()),e=a.normalize(e),0===e?this.schedule(b,d):this._scheduleFuture(b,e,d)},b._scheduleFuture=function(a,b,c){throw new z},a.now=w,a.prototype.now=w,a.normalize=function(a){return 0>a&&(a=0),a},a}(),X=W.normalize;W.isScheduler;!function(a){function b(a,b){function c(b){function d(a,b){return g?f.remove(i):h=!0,e(b,c),O}var g=!1,h=!1,i=a.schedule(b,d);h||(f.add(i),g=!0)}var d=b[0],e=b[1],f=new K;return e(d,c),f}function c(a,b){function c(b,d){function g(a,b){return h?f.remove(j):i=!0,e(b,c),O}var h=!1,i=!1,j=a.scheduleFuture(b,d,g);i||(f.add(j),h=!0)}var d=b[0],e=b[1],f=new K;return e(d,c),f}a.scheduleRecursive=function(a,c){return this.schedule([a,c],b)},a.scheduleRecursiveFuture=function(a,b,d){return this.scheduleFuture([a,d],b,c)}}(W.prototype),function(a){a.schedulePeriodic=function(a,b,c){if("undefined"==typeof t.setInterval)throw new A;b=X(b);var d=a,e=t.setInterval(function(){d=c(d)},b);return N(function(){t.clearInterval(e)})}}(W.prototype);var Y,Z,$=(u.internals.SchedulePeriodicRecursive=function(){function a(a){return function(b,c){c(0,a._period);var e=D(a._action)(a._state);e===C&&(a._cancel.dispose(),d(e.e)),a._state=e}}function b(a,b,c,d){this._scheduler=a,this._state=b,this._period=c,this._action=d}return b.prototype.start=function(){var b=new R;return this._cancel=b,b.setDisposable(this._scheduler.scheduleRecursiveFuture(0,this._period,a(this))),b},b}(),function(a){function b(){a.call(this)}return J(b,a),b.prototype.schedule=function(a,b){return Q(b(this,a))},b}(W)),_=(W.immediate=new $,function(a){function b(){for(;e.length>0;){var a=e.dequeue();!a.isCancelled()&&a.invoke()}}function c(){a.call(this)}var e;return J(c,a),c.prototype.schedule=function(a,c){var f=new V(this,a,c,this.now());if(e)e.enqueue(f);else{e=new fa(4),e.enqueue(f);var g=D(b)();e=null,g===C&&d(g.e)}return f.disposable},c.prototype.scheduleRequired=function(){return!e},c}(W)),aa=W.currentThread=new _,ba=function(){var a,b=v;if(t.setTimeout)a=t.setTimeout,b=t.clearTimeout;else{if(!t.WScript)throw new A;a=function(a,b){t.WScript.Sleep(b),a()}}return{setTimeout:a,clearTimeout:b}}(),ca=ba.setTimeout,da=ba.clearTimeout;!function(){function a(b){if(f)ca(function(){a(b)},0);else{var c=e[b];if(c){f=!0;var g=D(c)();Z(b),f=!1,g===C&&d(g.e)}}}function b(){if(!t.postMessage||t.importScripts)return!1;var a=!1,b=t.onmessage;return t.onmessage=function(){a=!0},t.postMessage("","*"),t.onmessage=b,a}var c=1,e={},f=!1;Z=function(a){delete e[a]};var g=new RegExp("^"+String(toString).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),h="function"==typeof(h=o&&r&&o.setImmediate)&&!g.test(h)&&h;if(isFunction(h))Y=function(b){var d=c++;return e[d]=b,h(function(){a(d)}),d};else if("undefined"!=typeof process&&"[object process]"==={}.toString.call(process))Y=function(b){var d=c++;return e[d]=b,process.nextTick(function(){a(d)}),d};else if(b()){var i="ms.rx.schedule"+Math.random(),j=function(b){"string"==typeof b.data&&b.data.substring(0,i.length)===i&&a(b.data.substring(i.length))};t.addEventListener("message",j,!1),Y=function(a){var b=c++;return e[b]=a,t.postMessage(i+b,"*"),b}}else if(t.MessageChannel){var k=new t.MessageChannel;k.port1.onmessage=function(b){a(b.data)},Y=function(a){var b=c++;return e[b]=a,k.port2.postMessage(b),b}}else Y="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(b){var d=t.document.createElement("script"),f=c++;return e[f]=b,d.onreadystatechange=function(){a(f),d.onreadystatechange=null,d.parentNode.removeChild(d),d=null},t.document.documentElement.appendChild(d),f}:function(b){var d=c++;return e[d]=b,ca(function(){a(d)},0),d}}();var ea=function(a){function b(){a.call(this)}function c(a,b,c,d){return function(){a.setDisposable(M._fixup(b(c,d)))}}function d(a){this._id=a,this.isDisposed=!1}function e(a){this._id=a,this.isDisposed=!1}return J(b,a),d.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,Z(this._id))},e.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,da(this._id))},b.prototype.schedule=function(a,b){var e=new R,f=Y(c(e,b,this,a));return new T(e,new d(f))},b.prototype._scheduleFuture=function(a,b,d){if(0===b)return this.schedule(a,d);var f=new R,g=ca(c(f,d,this,a),b);return new T(f,new e(g))},b}(W);W["default"]=W.async=new ea;k.prototype.compareTo=function(a){var b=this.value.compareTo(a.value);return 0===b&&(b=this.id-a.id),b};var fa=u.internals.PriorityQueue=function(a){this.items=new Array(a),this.length=0},ga=fa.prototype;ga.isHigherPriority=function(a,b){return this.items[a].compareTo(this.items[b])<0},ga.percolate=function(a){if(!(a>=this.length||0>a)){var b=a-1>>1;if(!(0>b||b===a)&&this.isHigherPriority(a,b)){var c=this.items[a];this.items[a]=this.items[b],this.items[b]=c,this.percolate(b)}}},ga.heapify=function(a){if(+a||(a=0),!(a>=this.length||0>a)){var b=2*a+1,c=2*a+2,d=a;if(b<this.length&&this.isHigherPriority(b,d)&&(d=b),c<this.length&&this.isHigherPriority(c,d)&&(d=c),d!==a){var e=this.items[a];this.items[a]=this.items[d],this.items[d]=e,this.heapify(d)}}},ga.peek=function(){return this.items[0].value},ga.removeAt=function(b){this.items[b]=this.items[--this.length],this.items[this.length]=a,this.heapify()},ga.dequeue=function(){var a=this.peek();return this.removeAt(0),a},ga.enqueue=function(a){var b=this.length++;this.items[b]=new k(fa.count++,a),this.percolate(b)},ga.remove=function(a){for(var b=0;b<this.length;b++)if(this.items[b].value===a)return this.removeAt(b),!0;return!1},fa.count=0;var ha,ia=u.Observer=function(){},ja=ia.create=function(a,b,c){return a||(a=v),b||(b=x),c||(c=v),new la(a,b,c)},ka=u.internals.AbstractObserver=function(a){function b(){this.isStopped=!1}return J(b,a),b.prototype.next=B,b.prototype.error=B,b.prototype.completed=B,b.prototype.onNext=function(a){!this.isStopped&&this.next(a)},b.prototype.onError=function(a){this.isStopped||(this.isStopped=!0,this.error(a))},b.prototype.onCompleted=function(){this.isStopped||(this.isStopped=!0,this.completed())},b.prototype.dispose=function(){this.isStopped=!0},b.prototype.fail=function(a){return this.isStopped?!1:(this.isStopped=!0,this.error(a),!0)},b}(ia),la=u.AnonymousObserver=function(a){function b(b,c,d){a.call(this),this._onNext=b,this._onError=c,this._onCompleted=d}return J(b,a),b.prototype.next=function(a){this._onNext(a)},b.prototype.error=function(a){this._onError(a)},b.prototype.completed=function(){this._onCompleted()},b}(ka),ma=u.Observable=function(){function a(a,b){return function(c){var d=c.onError;return c.onError=function(b){e(b,a),d.call(c,b)},b.call(a,c)}}function b(){if(u.config.longStackSupport&&E){var b=this._subscribe,c=D(d)(new Error).e;this.stack=c.stack.substring(c.stack.indexOf("\n")+1),this._subscribe=a(this,b)}}return ha=b.prototype,b.isObservable=function(a){return a&&isFunction(a.subscribe)},ha.subscribe=ha.forEach=function(a,b,c){return this._subscribe("object"==typeof a?a:ja(a,b,c))},ha.subscribeOnNext=function(a,b){return this._subscribe(ja("undefined"!=typeof b?function(c){a.call(b,c)}:a))},ha.subscribeOnError=function(a,b){return this._subscribe(ja(null,"undefined"!=typeof b?function(c){a.call(b,c)}:a))},ha.subscribeOnCompleted=function(a,b){return this._subscribe(ja(null,null,"undefined"!=typeof b?function(){a.call(b)}:a))},b}(),na=u.AnonymousObservable=function(a){function b(a){return a&&isFunction(a.dispose)?a:isFunction(a)?N(a):O}function c(a,c){var e=c[0],f=c[1],g=D(f.__subscribe).call(f,e);g!==C||e.fail(C.e)||d(C.e),e.setDisposable(b(g))}function e(b,c){this.source=c,this.__subscribe=b,a.call(this)}return J(e,a),e.prototype._subscribe=function(a){var b=new oa(a),d=[b,this];return aa.scheduleRequired()?aa.schedule(d,c):c(null,d),b},e}(ma),oa=(u.ObservableBase=function(a){function b(a){return a&&isFunction(a.dispose)?a:isFunction(a)?N(a):O}function c(a,c){var e=c[0],f=c[1],g=D(f.subscribeCore).call(f,e);g!==C||e.fail(C.e)||d(C.e),e.setDisposable(b(g))}function e(){a.call(this)}return J(e,a),e.prototype._subscribe=function(a){var b=new oa(a),d=[b,this];return aa.scheduleRequired()?aa.schedule(d,c):c(null,d),b},e.prototype.subscribeCore=B,e}(ma),function(a){function b(b){a.call(this),this.observer=b,this.m=new R}J(b,a);var c=b.prototype;return c.next=function(a){var b=D(this.observer.onNext).call(this.observer,a);b===C&&(this.dispose(),d(b.e))},c.error=function(a){var b=D(this.observer.onError).call(this.observer,a);this.dispose(),b===C&&d(b.e)},c.completed=function(){var a=D(this.observer.onCompleted).call(this.observer);this.dispose(),a===C&&d(a.e)},c.setDisposable=function(a){this.m.setDisposable(a)},c.getDisposable=function(){return this.m.getDisposable()},c.dispose=function(){a.prototype.dispose.call(this),this.m.dispose()},b}(ka));ma.create=function(a,b){return new na(a,b)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?(t.Rx=u,define(function(){return u})):m&&n?r?(n.exports=u).Rx=u:m.Rx=u:t.Rx=u;var pa=i()}).call(this); | ||
//# sourceMappingURL=rx.core.map |
@@ -330,3 +330,3 @@ // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. | ||
} catch (e) { | ||
observableThrow(e).subscribe(o); | ||
return observableThrow(e).subscribe(o); | ||
} | ||
@@ -333,0 +333,0 @@ var group = new CompositeDisposable(); |
/* 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 w.e=b,w}}}function f(a){this.patterns=a}function g(a,b){this.expression=a,this.selector=b}function h(a){return function(b){a.onError(b)}}function i(a,b){return function(){var c=x(a.selector).apply(a,arguments);return c===w?b.onError(c.e):void b.onNext(c)}}function j(a,b,c){var d=a.get(b);if(!d){var e=new z(b,c);return a.set(b,e),e}return d}function k(a,b,c){this.joinObserverArray=a,this.onNext=b,this.onCompleted=c,this.joinObservers=new y;for(var d=0,e=this.joinObserverArray.length;e>d;d++){var f=this.joinObserverArray[d];this.joinObservers.set(f,f)}}var l=c.Observable,m=l.prototype,n=c.AnonymousObservable,o=l.throwError,p=c.Observer.create,q=c.SingleAssignmentDisposable,r=c.CompositeDisposable,s=c.internals.AbstractObserver,t=c.helpers.noop,u=c.internals.inherits,v=c.helpers.isFunction,w={e:{}},x=c.internals.tryCatch=function(a){if(!v(a))throw new TypeError("fn must be a function");return e(a)},y=a.Map||function(){function a(){this.size=0,this._values=[],this._keys=[]}return a.prototype["delete"]=function(a){var b=this._keys.indexOf(a);return-1===b?!1:(this._values.splice(b,1),this._keys.splice(b,1),this.size--,!0)},a.prototype.get=function(a){var b=this._keys.indexOf(a);return-1===b?d:this._values[b]},a.prototype.set=function(a,b){var c=this._keys.indexOf(a);return-1===c?(this._keys.push(a),this._values.push(b),this.size++):this._values[c]=b,this},a.prototype.forEach=function(a,b){for(var c=0;c<this.size;c++)a.call(b,this._values[c],this._keys[c])},a}();f.prototype.and=function(a){return new f(this.patterns.concat(a))},f.prototype.thenDo=function(a){return new g(this,a)},g.prototype.activate=function(a,b,c){for(var d=[],e=h(b),f=0,g=this.expression.patterns.length;g>f;f++)d.push(j(a,this.expression.patterns[f],e));var l=new k(d,i(this,b),function(){for(var a=0,b=d.length;b>a;a++)d[a].removeActivePlan(l);c(l)});for(f=0,g=d.length;g>f;f++)d[f].addActivePlan(l);return l},k.prototype.dequeue=function(){this.joinObservers.forEach(function(a){a.queue.shift()})},k.prototype.match=function(){var a,b,c=!0;for(a=0,b=this.joinObserverArray.length;b>a;a++)if(0===this.joinObserverArray[a].queue.length){c=!1;break}if(c){var d=[],e=!1;for(a=0,b=this.joinObserverArray.length;b>a;a++)d.push(this.joinObserverArray[a].queue[0]),"C"===this.joinObserverArray[a].queue[0].kind&&(e=!0);if(e)this.onCompleted();else{this.dequeue();var f=[];for(a=0,b=d.length;a<d.length;a++)f.push(d[a].value);this.onNext.apply(this,f)}}};var z=function(a){function b(b,c){a.call(this),this.source=b,this.onError=c,this.queue=[],this.activePlans=[],this.subscription=new q,this.isDisposed=!1}u(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return this.onError(a.error);this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=t,c.completed=t,c.addActivePlan=function(a){this.activePlans.push(a)},c.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},c.removeActivePlan=function(a){this.activePlans.splice(this.activePlans.indexOf(a),1),0===this.activePlans.length&&this.dispose()},c.dispose=function(){a.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},b}(s);return m.and=function(a){return new f([this,a])},m.thenDo=function(a){return new f([this]).thenDo(a)},l.when=function(){var a,b=arguments.length;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new n(function(b){var c=[],d=new y,e=p(function(a){b.onNext(a)},function(a){d.forEach(function(b){b.onError(a)}),b.onError(a)},function(a){b.onCompleted()});try{for(var f=0,g=a.length;g>f;f++)c.push(a[f].activate(d,e,function(a){var d=c.indexOf(a);c.splice(d,1),0===c.length&&b.onCompleted()}))}catch(h){o(h).subscribe(b)}var i=new r;return d.forEach(function(a){a.subscribe(),i.add(a)}),i})},c}); | ||
(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 w.e=b,w}}}function f(a){this.patterns=a}function g(a,b){this.expression=a,this.selector=b}function h(a){return function(b){a.onError(b)}}function i(a,b){return function(){var c=x(a.selector).apply(a,arguments);return c===w?b.onError(c.e):void b.onNext(c)}}function j(a,b,c){var d=a.get(b);if(!d){var e=new z(b,c);return a.set(b,e),e}return d}function k(a,b,c){this.joinObserverArray=a,this.onNext=b,this.onCompleted=c,this.joinObservers=new y;for(var d=0,e=this.joinObserverArray.length;e>d;d++){var f=this.joinObserverArray[d];this.joinObservers.set(f,f)}}var l=c.Observable,m=l.prototype,n=c.AnonymousObservable,o=l.throwError,p=c.Observer.create,q=c.SingleAssignmentDisposable,r=c.CompositeDisposable,s=c.internals.AbstractObserver,t=c.helpers.noop,u=c.internals.inherits,v=c.helpers.isFunction,w={e:{}},x=c.internals.tryCatch=function(a){if(!v(a))throw new TypeError("fn must be a function");return e(a)},y=a.Map||function(){function a(){this.size=0,this._values=[],this._keys=[]}return a.prototype["delete"]=function(a){var b=this._keys.indexOf(a);return-1===b?!1:(this._values.splice(b,1),this._keys.splice(b,1),this.size--,!0)},a.prototype.get=function(a){var b=this._keys.indexOf(a);return-1===b?d:this._values[b]},a.prototype.set=function(a,b){var c=this._keys.indexOf(a);return-1===c?(this._keys.push(a),this._values.push(b),this.size++):this._values[c]=b,this},a.prototype.forEach=function(a,b){for(var c=0;c<this.size;c++)a.call(b,this._values[c],this._keys[c])},a}();f.prototype.and=function(a){return new f(this.patterns.concat(a))},f.prototype.thenDo=function(a){return new g(this,a)},g.prototype.activate=function(a,b,c){for(var d=[],e=h(b),f=0,g=this.expression.patterns.length;g>f;f++)d.push(j(a,this.expression.patterns[f],e));var l=new k(d,i(this,b),function(){for(var a=0,b=d.length;b>a;a++)d[a].removeActivePlan(l);c(l)});for(f=0,g=d.length;g>f;f++)d[f].addActivePlan(l);return l},k.prototype.dequeue=function(){this.joinObservers.forEach(function(a){a.queue.shift()})},k.prototype.match=function(){var a,b,c=!0;for(a=0,b=this.joinObserverArray.length;b>a;a++)if(0===this.joinObserverArray[a].queue.length){c=!1;break}if(c){var d=[],e=!1;for(a=0,b=this.joinObserverArray.length;b>a;a++)d.push(this.joinObserverArray[a].queue[0]),"C"===this.joinObserverArray[a].queue[0].kind&&(e=!0);if(e)this.onCompleted();else{this.dequeue();var f=[];for(a=0,b=d.length;a<d.length;a++)f.push(d[a].value);this.onNext.apply(this,f)}}};var z=function(a){function b(b,c){a.call(this),this.source=b,this.onError=c,this.queue=[],this.activePlans=[],this.subscription=new q,this.isDisposed=!1}u(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return this.onError(a.error);this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=t,c.completed=t,c.addActivePlan=function(a){this.activePlans.push(a)},c.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},c.removeActivePlan=function(a){this.activePlans.splice(this.activePlans.indexOf(a),1),0===this.activePlans.length&&this.dispose()},c.dispose=function(){a.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},b}(s);return m.and=function(a){return new f([this,a])},m.thenDo=function(a){return new f([this]).thenDo(a)},l.when=function(){var a,b=arguments.length;if(Array.isArray(arguments[0]))a=arguments[0];else{a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new n(function(b){var c=[],d=new y,e=p(function(a){b.onNext(a)},function(a){d.forEach(function(b){b.onError(a)}),b.onError(a)},function(a){b.onCompleted()});try{for(var f=0,g=a.length;g>f;f++)c.push(a[f].activate(d,e,function(a){var d=c.indexOf(a);c.splice(d,1),0===c.length&&b.onCompleted()}))}catch(h){return o(h).subscribe(b)}var i=new r;return d.forEach(function(a){a.subscribe(),i.add(a)}),i})},c}); | ||
//# sourceMappingURL=rx.joinpatterns.map |
@@ -306,3 +306,3 @@ // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. | ||
function GenerateObservable(state, cndFn, itrFn, resFn, s) { | ||
this._state = state; | ||
this._initialState = state; | ||
this._cndFn = cndFn; | ||
@@ -312,22 +312,21 @@ this._itrFn = itrFn; | ||
this._s = s; | ||
this._first = true; | ||
__super__.call(this); | ||
} | ||
function scheduleRecursive(self, recurse) { | ||
if (self._first) { | ||
self._first = false; | ||
function scheduleRecursive(state, recurse) { | ||
if (state.first) { | ||
state.first = false; | ||
} else { | ||
self._state = tryCatch(self._itrFn)(self._state); | ||
if (self._state === errorObj) { return self._o.onError(self._state.e); } | ||
state.newState = tryCatch(state.self._itrFn)(state.newState); | ||
if (state.newState === errorObj) { return state.o.onError(state.newState.e); } | ||
} | ||
var hasResult = tryCatch(self._cndFn)(self._state); | ||
if (hasResult === errorObj) { return self._o.onError(hasResult.e); } | ||
var hasResult = tryCatch(state.self._cndFn)(state.newState); | ||
if (hasResult === errorObj) { return state.o.onError(hasResult.e); } | ||
if (hasResult) { | ||
var result = tryCatch(self._resFn)(self._state); | ||
if (result === errorObj) { return self._o.onError(result.e); } | ||
self._o.onNext(result); | ||
recurse(self); | ||
var result = tryCatch(state.self._resFn)(state.newState); | ||
if (result === errorObj) { return state.o.onError(result.e); } | ||
state.o.onNext(result); | ||
recurse(state); | ||
} else { | ||
self._o.onCompleted(); | ||
state.o.onCompleted(); | ||
} | ||
@@ -337,4 +336,9 @@ } | ||
GenerateObservable.prototype.subscribeCore = function (o) { | ||
this._o = o; | ||
return this._s.scheduleRecursive(this, scheduleRecursive); | ||
var state = { | ||
o: o, | ||
self: this, | ||
first: true, | ||
newState: this._initialState | ||
}; | ||
return this._s.scheduleRecursive(state, scheduleRecursive); | ||
}; | ||
@@ -341,0 +345,0 @@ |
/* 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.lite.compat"],function(b,c){return a(j,c,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(j,module.exports,require("rx-lite-compat")):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 S.e=b,S}}}function f(a){throw a}function g(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function h(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function i(a,b){return a.amb(b)}function j(a){return a.toArray()}function k(a){return a.length>0}function l(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function m(a){this.comparer=a,this.set=[]}var n=c.Observable,o=n.prototype,p=n.never,q=n["throw"],r=c.AnonymousObservable,s=c.ObservableBase,t=c.AnonymousObserver,u=c.Notification.createOnNext,v=c.Notification.createOnError,w=c.Notification.createOnCompleted,x=c.Observer,y=x.create,z=c.internals.AbstractObserver,A=c.Subject,B=c.internals,C=c.helpers,D=B.ScheduledObserver,E=c.SerialDisposable,F=c.SingleAssignmentDisposable,G=(c.CompositeDisposable,c.BinaryDisposable),H=c.RefCountDisposable,I=c.Disposable.empty,J=c.Scheduler.immediate,K=(C.defaultKeySerializer,c.internals.addRef),L=(C.identity,C.isPromise),M=C.isFunction,N=B.inherits,O=B.bindCallback,P=(C.noop,c.Scheduler.isScheduler),Q=n.fromPromise,R=c.ArgumentOutOfRangeError,S={e:{}},T=c.internals.tryCatch=function(a){if(!M(a))throw new TypeError("fn must be a function");return e(a)};g.prototype.dispose=function(){this.scheduler.schedule(this,h)};var U=function(a){function b(b){a.call(this),this._observer=b,this._state=0}N(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=T(this._observer.onNext).call(this._observer,a);this._state=0,b===S&&f(b.e)},c.onError=function(a){this.checkAccess();var b=T(this._observer.onError).call(this._observer,a);this._state=2,b===S&&f(b.e)},c.onCompleted=function(){this.checkAccess();var a=T(this._observer.onCompleted).call(this._observer);this._state=2,a===S&&f(a.e)},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}(x),V=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return N(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.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(D);x.prototype.checked=function(){return new U(this)},x.notifyOn=function(a){return new V(a,this)},x.fromNotifier=function(a,b){var c=O(a,b,1);return new t(function(a){return c(u(a))},function(a){return c(v(a))},function(){return c(w())})},x.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},x.prototype.asObserver=function(){var a=this;return new t(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})};var W=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new V(this._s,a))},b}(s);o.observeOn=function(a){return new W(this,a)};var X=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}function c(a,b){var c=b[0],d=b[1],e=b[2];d.setDisposable(new g(a,c.subscribe(e)))}return N(b,a),b.prototype.subscribeCore=function(a){var b=new F,d=new E;return d.setDisposable(b),b.setDisposable(this._s.schedule([this.source,d,a],c)),d},b}(s);o.subscribeOn=function(a){return new X(this,a)};var Y=function(a){function b(b,c,d,e,f){this._state=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._s=f,this._first=!0,a.call(this)}function c(a,b){if(a._first)a._first=!1;else if(a._state=T(a._itrFn)(a._state),a._state===S)return a._o.onError(a._state.e);var c=T(a._cndFn)(a._state);if(c===S)return a._o.onError(c.e);if(c){var d=T(a._resFn)(a._state);if(d===S)return a._o.onError(d.e);a._o.onNext(d),b(a)}else a._o.onCompleted()}return N(b,a),b.prototype.subscribeCore=function(a){return this._o=a,this._s.scheduleRecursive(this,c)},b}(s);n.generate=function(a,b,c,d,e){return P(e)||(e=currentThreadScheduler),new Y(a,b,c,d,e)};var Z=function(a){function b(b,c){this._resFn=b,this._obsFn=c,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){var b=I,c=T(this._resFn)();if(c===S)return new G(q(c.e).subscribe(a),b);c&&(b=c);var d=T(this._obsFn)(c);return d===S?new G(q(d.e).subscribe(a),b):new G(d.subscribe(a),b)},b}(s);n.using=function(a,b){return new Z(a,b)},o.amb=function(a){var b=this;return new r(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new F,j=new F;L(a)&&(a=Q(a));var k=y(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()}),l=y(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()});return i.setDisposable(b.subscribe(k)),j.setDisposable(a.subscribe(l)),new G(i,j)})},n.amb=function(){var a,b=p();if(Array.isArray(arguments[0]))a=arguments[0];else{var c=arguments.length;a=new Array(a);for(var d=0;c>d;d++)a[d]=arguments[d]}for(var d=0,c=a.length;c>d;d++)b=i(b,a[d]);return b},o.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return aa([this,a])};var $=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){if(a.pos<a.sources.length){var c=a.sources[a.pos++];L(c)&&(c=Q(c));var d=new F;a.subscription.setDisposable(d),d.setDisposable(c.subscribe(new _(a,b)))}else a.o.onCompleted()}return N(b,a),b.prototype.subscribeCore=function(a){var b=new E,d={pos:0,subscription:b,o:a,sources:this.sources},e=J.scheduleRecursive(d,c);return new G(b,e)},b}(s),_=function(a){function b(b,c){this._state=b,this._recurse=c,a.call(this)}return N(b,a),b.prototype.next=function(a){this._state.o.onNext(a)},b.prototype.error=function(){this._recurse(this._state)},b.prototype.completed=function(){this._recurse(this._state)},b}(z),aa=n.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new $(a)};o.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).flatMap(j).filter(k)},o.windowWithCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new R;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new R;return new r(function(d){function e(){var a=new A;i.push(a),d.onNext(K(a,g))}var f=new F,g=new H(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)};var ba=function(a){function b(b,c){this._o=b,this._c=c,this._q=[],a.call(this)}return N(b,a),b.prototype.next=function(a){this._q.push(a),this._q.length>this._c&&this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._q),this._o.onCompleted()},b}(z);o.takeLastBuffer=function(a){if(0>a)throw new R;var b=this;return new r(function(c){return b.subscribe(new ba(c,a))},b)};var ca=function(a){function b(b,c){this._o=b,this._d=c,this._f=!1,a.call(this)}return N(b,a),b.prototype.next=function(a){this._f=!0,this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){!this._f&&this._o.onNext(this._d),this._o.onCompleted()},b}(z);o.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new r(function(c){return b.subscribe(new ca(c,a))},b)},m.prototype.push=function(a){var b=-1===l(this.set,a,this.comparer);return b&&this.set.push(a),b};var da=function(a){function b(b,c,d){this.source=b,this._keyFn=c,this._cmpFn=d,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ea(a,this._keyFn,this._cmpFn))},b}(s),ea=function(a){function b(b,c,d){this._o=b,this._keyFn=c,this._h=new m(d),a.call(this)}return N(b,a),b.prototype.next=function(a){var b=a;return M(this._keyFn)&&(b=T(this._keyFn)(a),b===S)?this._o.onError(b.e):void(this._h.push(b)&&this._o.onNext(a))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(z);return o.distinct=function(a,b){return b||(b=defaultComparer),new da(this,a,b)},o.singleInstance=function(){function a(){return d||(d=!0,b=c["finally"](function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new r(function(b){return a().subscribe(b)})},c}); | ||
(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.lite.compat"],function(b,c){return a(j,c,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(j,module.exports,require("rx-lite-compat")):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 S.e=b,S}}}function f(a){throw a}function g(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function h(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function i(a,b){return a.amb(b)}function j(a){return a.toArray()}function k(a){return a.length>0}function l(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function m(a){this.comparer=a,this.set=[]}var n=c.Observable,o=n.prototype,p=n.never,q=n["throw"],r=c.AnonymousObservable,s=c.ObservableBase,t=c.AnonymousObserver,u=c.Notification.createOnNext,v=c.Notification.createOnError,w=c.Notification.createOnCompleted,x=c.Observer,y=x.create,z=c.internals.AbstractObserver,A=c.Subject,B=c.internals,C=c.helpers,D=B.ScheduledObserver,E=c.SerialDisposable,F=c.SingleAssignmentDisposable,G=(c.CompositeDisposable,c.BinaryDisposable),H=c.RefCountDisposable,I=c.Disposable.empty,J=c.Scheduler.immediate,K=(C.defaultKeySerializer,c.internals.addRef),L=(C.identity,C.isPromise),M=C.isFunction,N=B.inherits,O=B.bindCallback,P=(C.noop,c.Scheduler.isScheduler),Q=n.fromPromise,R=c.ArgumentOutOfRangeError,S={e:{}},T=c.internals.tryCatch=function(a){if(!M(a))throw new TypeError("fn must be a function");return e(a)};g.prototype.dispose=function(){this.scheduler.schedule(this,h)};var U=function(a){function b(b){a.call(this),this._observer=b,this._state=0}N(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=T(this._observer.onNext).call(this._observer,a);this._state=0,b===S&&f(b.e)},c.onError=function(a){this.checkAccess();var b=T(this._observer.onError).call(this._observer,a);this._state=2,b===S&&f(b.e)},c.onCompleted=function(){this.checkAccess();var a=T(this._observer.onCompleted).call(this._observer);this._state=2,a===S&&f(a.e)},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}(x),V=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return N(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.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(D);x.prototype.checked=function(){return new U(this)},x.notifyOn=function(a){return new V(a,this)},x.fromNotifier=function(a,b){var c=O(a,b,1);return new t(function(a){return c(u(a))},function(a){return c(v(a))},function(){return c(w())})},x.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},x.prototype.asObserver=function(){var a=this;return new t(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})};var W=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new V(this._s,a))},b}(s);o.observeOn=function(a){return new W(this,a)};var X=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}function c(a,b){var c=b[0],d=b[1],e=b[2];d.setDisposable(new g(a,c.subscribe(e)))}return N(b,a),b.prototype.subscribeCore=function(a){var b=new F,d=new E;return d.setDisposable(b),b.setDisposable(this._s.schedule([this.source,d,a],c)),d},b}(s);o.subscribeOn=function(a){return new X(this,a)};var Y=function(a){function b(b,c,d,e,f){this._initialState=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._s=f,a.call(this)}function c(a,b){if(a.first)a.first=!1;else if(a.newState=T(a.self._itrFn)(a.newState),a.newState===S)return a.o.onError(a.newState.e);var c=T(a.self._cndFn)(a.newState);if(c===S)return a.o.onError(c.e);if(c){var d=T(a.self._resFn)(a.newState);if(d===S)return a.o.onError(d.e);a.o.onNext(d),b(a)}else a.o.onCompleted()}return N(b,a),b.prototype.subscribeCore=function(a){var b={o:a,self:this,first:!0,newState:this._initialState};return this._s.scheduleRecursive(b,c)},b}(s);n.generate=function(a,b,c,d,e){return P(e)||(e=currentThreadScheduler),new Y(a,b,c,d,e)};var Z=function(a){function b(b,c){this._resFn=b,this._obsFn=c,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){var b=I,c=T(this._resFn)();if(c===S)return new G(q(c.e).subscribe(a),b);c&&(b=c);var d=T(this._obsFn)(c);return d===S?new G(q(d.e).subscribe(a),b):new G(d.subscribe(a),b)},b}(s);n.using=function(a,b){return new Z(a,b)},o.amb=function(a){var b=this;return new r(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new F,j=new F;L(a)&&(a=Q(a));var k=y(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()}),l=y(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()});return i.setDisposable(b.subscribe(k)),j.setDisposable(a.subscribe(l)),new G(i,j)})},n.amb=function(){var a,b=p();if(Array.isArray(arguments[0]))a=arguments[0];else{var c=arguments.length;a=new Array(a);for(var d=0;c>d;d++)a[d]=arguments[d]}for(var d=0,c=a.length;c>d;d++)b=i(b,a[d]);return b},o.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return aa([this,a])};var $=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){if(a.pos<a.sources.length){var c=a.sources[a.pos++];L(c)&&(c=Q(c));var d=new F;a.subscription.setDisposable(d),d.setDisposable(c.subscribe(new _(a,b)))}else a.o.onCompleted()}return N(b,a),b.prototype.subscribeCore=function(a){var b=new E,d={pos:0,subscription:b,o:a,sources:this.sources},e=J.scheduleRecursive(d,c);return new G(b,e)},b}(s),_=function(a){function b(b,c){this._state=b,this._recurse=c,a.call(this)}return N(b,a),b.prototype.next=function(a){this._state.o.onNext(a)},b.prototype.error=function(){this._recurse(this._state)},b.prototype.completed=function(){this._recurse(this._state)},b}(z),aa=n.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new $(a)};o.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).flatMap(j).filter(k)},o.windowWithCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new R;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new R;return new r(function(d){function e(){var a=new A;i.push(a),d.onNext(K(a,g))}var f=new F,g=new H(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)};var ba=function(a){function b(b,c){this._o=b,this._c=c,this._q=[],a.call(this)}return N(b,a),b.prototype.next=function(a){this._q.push(a),this._q.length>this._c&&this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._q),this._o.onCompleted()},b}(z);o.takeLastBuffer=function(a){if(0>a)throw new R;var b=this;return new r(function(c){return b.subscribe(new ba(c,a))},b)};var ca=function(a){function b(b,c){this._o=b,this._d=c,this._f=!1,a.call(this)}return N(b,a),b.prototype.next=function(a){this._f=!0,this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){!this._f&&this._o.onNext(this._d),this._o.onCompleted()},b}(z);o.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new r(function(c){return b.subscribe(new ca(c,a))},b)},m.prototype.push=function(a){var b=-1===l(this.set,a,this.comparer);return b&&this.set.push(a),b};var da=function(a){function b(b,c,d){this.source=b,this._keyFn=c,this._cmpFn=d,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ea(a,this._keyFn,this._cmpFn))},b}(s),ea=function(a){function b(b,c,d){this._o=b,this._keyFn=c,this._h=new m(d),a.call(this)}return N(b,a),b.prototype.next=function(a){var b=a;return M(this._keyFn)&&(b=T(this._keyFn)(a),b===S)?this._o.onError(b.e):void(this._h.push(b)&&this._o.onNext(a))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(z);return o.distinct=function(a,b){return b||(b=defaultComparer),new da(this,a,b)},o.singleInstance=function(){function a(){return d||(d=!0,b=c["finally"](function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new r(function(b){return a().subscribe(b)})},c}); | ||
//# sourceMappingURL=rx.lite.extras.compat.map |
@@ -306,3 +306,3 @@ // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. | ||
function GenerateObservable(state, cndFn, itrFn, resFn, s) { | ||
this._state = state; | ||
this._initialState = state; | ||
this._cndFn = cndFn; | ||
@@ -312,22 +312,21 @@ this._itrFn = itrFn; | ||
this._s = s; | ||
this._first = true; | ||
__super__.call(this); | ||
} | ||
function scheduleRecursive(self, recurse) { | ||
if (self._first) { | ||
self._first = false; | ||
function scheduleRecursive(state, recurse) { | ||
if (state.first) { | ||
state.first = false; | ||
} else { | ||
self._state = tryCatch(self._itrFn)(self._state); | ||
if (self._state === errorObj) { return self._o.onError(self._state.e); } | ||
state.newState = tryCatch(state.self._itrFn)(state.newState); | ||
if (state.newState === errorObj) { return state.o.onError(state.newState.e); } | ||
} | ||
var hasResult = tryCatch(self._cndFn)(self._state); | ||
if (hasResult === errorObj) { return self._o.onError(hasResult.e); } | ||
var hasResult = tryCatch(state.self._cndFn)(state.newState); | ||
if (hasResult === errorObj) { return state.o.onError(hasResult.e); } | ||
if (hasResult) { | ||
var result = tryCatch(self._resFn)(self._state); | ||
if (result === errorObj) { return self._o.onError(result.e); } | ||
self._o.onNext(result); | ||
recurse(self); | ||
var result = tryCatch(state.self._resFn)(state.newState); | ||
if (result === errorObj) { return state.o.onError(result.e); } | ||
state.o.onNext(result); | ||
recurse(state); | ||
} else { | ||
self._o.onCompleted(); | ||
state.o.onCompleted(); | ||
} | ||
@@ -337,4 +336,9 @@ } | ||
GenerateObservable.prototype.subscribeCore = function (o) { | ||
this._o = o; | ||
return this._s.scheduleRecursive(this, scheduleRecursive); | ||
var state = { | ||
o: o, | ||
self: this, | ||
first: true, | ||
newState: this._initialState | ||
}; | ||
return this._s.scheduleRecursive(state, scheduleRecursive); | ||
}; | ||
@@ -341,0 +345,0 @@ |
/* 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.lite"],function(b,c){return a(j,c,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(j,module.exports,require("rx-lite")):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 S.e=b,S}}}function f(a){throw a}function g(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function h(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function i(a,b){return a.amb(b)}function j(a){return a.toArray()}function k(a){return a.length>0}function l(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function m(a){this.comparer=a,this.set=[]}var n=c.Observable,o=n.prototype,p=n.never,q=n["throw"],r=c.AnonymousObservable,s=c.ObservableBase,t=c.AnonymousObserver,u=c.Notification.createOnNext,v=c.Notification.createOnError,w=c.Notification.createOnCompleted,x=c.Observer,y=x.create,z=c.internals.AbstractObserver,A=c.Subject,B=c.internals,C=c.helpers,D=B.ScheduledObserver,E=c.SerialDisposable,F=c.SingleAssignmentDisposable,G=(c.CompositeDisposable,c.BinaryDisposable),H=c.RefCountDisposable,I=c.Disposable.empty,J=c.Scheduler.immediate,K=(C.defaultKeySerializer,c.internals.addRef),L=(C.identity,C.isPromise),M=C.isFunction,N=B.inherits,O=B.bindCallback,P=(C.noop,c.Scheduler.isScheduler),Q=n.fromPromise,R=c.ArgumentOutOfRangeError,S={e:{}},T=c.internals.tryCatch=function(a){if(!M(a))throw new TypeError("fn must be a function");return e(a)};g.prototype.dispose=function(){this.scheduler.schedule(this,h)};var U=function(a){function b(b){a.call(this),this._observer=b,this._state=0}N(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=T(this._observer.onNext).call(this._observer,a);this._state=0,b===S&&f(b.e)},c.onError=function(a){this.checkAccess();var b=T(this._observer.onError).call(this._observer,a);this._state=2,b===S&&f(b.e)},c.onCompleted=function(){this.checkAccess();var a=T(this._observer.onCompleted).call(this._observer);this._state=2,a===S&&f(a.e)},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}(x),V=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return N(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.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(D);x.prototype.checked=function(){return new U(this)},x.notifyOn=function(a){return new V(a,this)},x.fromNotifier=function(a,b){var c=O(a,b,1);return new t(function(a){return c(u(a))},function(a){return c(v(a))},function(){return c(w())})},x.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},x.prototype.asObserver=function(){var a=this;return new t(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})};var W=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new V(this._s,a))},b}(s);o.observeOn=function(a){return new W(this,a)};var X=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}function c(a,b){var c=b[0],d=b[1],e=b[2];d.setDisposable(new g(a,c.subscribe(e)))}return N(b,a),b.prototype.subscribeCore=function(a){var b=new F,d=new E;return d.setDisposable(b),b.setDisposable(this._s.schedule([this.source,d,a],c)),d},b}(s);o.subscribeOn=function(a){return new X(this,a)};var Y=function(a){function b(b,c,d,e,f){this._state=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._s=f,this._first=!0,a.call(this)}function c(a,b){if(a._first)a._first=!1;else if(a._state=T(a._itrFn)(a._state),a._state===S)return a._o.onError(a._state.e);var c=T(a._cndFn)(a._state);if(c===S)return a._o.onError(c.e);if(c){var d=T(a._resFn)(a._state);if(d===S)return a._o.onError(d.e);a._o.onNext(d),b(a)}else a._o.onCompleted()}return N(b,a),b.prototype.subscribeCore=function(a){return this._o=a,this._s.scheduleRecursive(this,c)},b}(s);n.generate=function(a,b,c,d,e){return P(e)||(e=currentThreadScheduler),new Y(a,b,c,d,e)};var Z=function(a){function b(b,c){this._resFn=b,this._obsFn=c,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){var b=I,c=T(this._resFn)();if(c===S)return new G(q(c.e).subscribe(a),b);c&&(b=c);var d=T(this._obsFn)(c);return d===S?new G(q(d.e).subscribe(a),b):new G(d.subscribe(a),b)},b}(s);n.using=function(a,b){return new Z(a,b)},o.amb=function(a){var b=this;return new r(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new F,j=new F;L(a)&&(a=Q(a));var k=y(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()}),l=y(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()});return i.setDisposable(b.subscribe(k)),j.setDisposable(a.subscribe(l)),new G(i,j)})},n.amb=function(){var a,b=p();if(Array.isArray(arguments[0]))a=arguments[0];else{var c=arguments.length;a=new Array(a);for(var d=0;c>d;d++)a[d]=arguments[d]}for(var d=0,c=a.length;c>d;d++)b=i(b,a[d]);return b},o.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return aa([this,a])};var $=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){if(a.pos<a.sources.length){var c=a.sources[a.pos++];L(c)&&(c=Q(c));var d=new F;a.subscription.setDisposable(d),d.setDisposable(c.subscribe(new _(a,b)))}else a.o.onCompleted()}return N(b,a),b.prototype.subscribeCore=function(a){var b=new E,d={pos:0,subscription:b,o:a,sources:this.sources},e=J.scheduleRecursive(d,c);return new G(b,e)},b}(s),_=function(a){function b(b,c){this._state=b,this._recurse=c,a.call(this)}return N(b,a),b.prototype.next=function(a){this._state.o.onNext(a)},b.prototype.error=function(){this._recurse(this._state)},b.prototype.completed=function(){this._recurse(this._state)},b}(z),aa=n.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new $(a)};o.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).flatMap(j).filter(k)},o.windowWithCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new R;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new R;return new r(function(d){function e(){var a=new A;i.push(a),d.onNext(K(a,g))}var f=new F,g=new H(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)};var ba=function(a){function b(b,c){this._o=b,this._c=c,this._q=[],a.call(this)}return N(b,a),b.prototype.next=function(a){this._q.push(a),this._q.length>this._c&&this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._q),this._o.onCompleted()},b}(z);o.takeLastBuffer=function(a){if(0>a)throw new R;var b=this;return new r(function(c){return b.subscribe(new ba(c,a))},b)};var ca=function(a){function b(b,c){this._o=b,this._d=c,this._f=!1,a.call(this)}return N(b,a),b.prototype.next=function(a){this._f=!0,this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){!this._f&&this._o.onNext(this._d),this._o.onCompleted()},b}(z);o.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new r(function(c){return b.subscribe(new ca(c,a))},b)},m.prototype.push=function(a){var b=-1===l(this.set,a,this.comparer);return b&&this.set.push(a),b};var da=function(a){function b(b,c,d){this.source=b,this._keyFn=c,this._cmpFn=d,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ea(a,this._keyFn,this._cmpFn))},b}(s),ea=function(a){function b(b,c,d){this._o=b,this._keyFn=c,this._h=new m(d),a.call(this)}return N(b,a),b.prototype.next=function(a){var b=a;return M(this._keyFn)&&(b=T(this._keyFn)(a),b===S)?this._o.onError(b.e):void(this._h.push(b)&&this._o.onNext(a))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(z);return o.distinct=function(a,b){return b||(b=defaultComparer),new da(this,a,b)},o.singleInstance=function(){function a(){return d||(d=!0,b=c["finally"](function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new r(function(b){return a().subscribe(b)})},c}); | ||
(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.lite"],function(b,c){return a(j,c,b)}):"object"==typeof module&&module&&module.exports===d?module.exports=a(j,module.exports,require("rx-lite")):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 S.e=b,S}}}function f(a){throw a}function g(a,b){this.scheduler=a,this.disposable=b,this.isDisposed=!1}function h(a,b){b.isDisposed||(b.isDisposed=!0,b.disposable.dispose())}function i(a,b){return a.amb(b)}function j(a){return a.toArray()}function k(a){return a.length>0}function l(a,b,c){for(var d=0,e=a.length;e>d;d++)if(c(a[d],b))return d;return-1}function m(a){this.comparer=a,this.set=[]}var n=c.Observable,o=n.prototype,p=n.never,q=n["throw"],r=c.AnonymousObservable,s=c.ObservableBase,t=c.AnonymousObserver,u=c.Notification.createOnNext,v=c.Notification.createOnError,w=c.Notification.createOnCompleted,x=c.Observer,y=x.create,z=c.internals.AbstractObserver,A=c.Subject,B=c.internals,C=c.helpers,D=B.ScheduledObserver,E=c.SerialDisposable,F=c.SingleAssignmentDisposable,G=(c.CompositeDisposable,c.BinaryDisposable),H=c.RefCountDisposable,I=c.Disposable.empty,J=c.Scheduler.immediate,K=(C.defaultKeySerializer,c.internals.addRef),L=(C.identity,C.isPromise),M=C.isFunction,N=B.inherits,O=B.bindCallback,P=(C.noop,c.Scheduler.isScheduler),Q=n.fromPromise,R=c.ArgumentOutOfRangeError,S={e:{}},T=c.internals.tryCatch=function(a){if(!M(a))throw new TypeError("fn must be a function");return e(a)};g.prototype.dispose=function(){this.scheduler.schedule(this,h)};var U=function(a){function b(b){a.call(this),this._observer=b,this._state=0}N(b,a);var c=b.prototype;return c.onNext=function(a){this.checkAccess();var b=T(this._observer.onNext).call(this._observer,a);this._state=0,b===S&&f(b.e)},c.onError=function(a){this.checkAccess();var b=T(this._observer.onError).call(this._observer,a);this._state=2,b===S&&f(b.e)},c.onCompleted=function(){this.checkAccess();var a=T(this._observer.onCompleted).call(this._observer);this._state=2,a===S&&f(a.e)},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}(x),V=function(a){function b(b,c,d){a.call(this,b,c),this._cancel=d}return N(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.prototype.dispose=function(){a.prototype.dispose.call(this),this._cancel&&this._cancel.dispose(),this._cancel=null},b}(D);x.prototype.checked=function(){return new U(this)},x.notifyOn=function(a){return new V(a,this)},x.fromNotifier=function(a,b){var c=O(a,b,1);return new t(function(a){return c(u(a))},function(a){return c(v(a))},function(){return c(w())})},x.prototype.toNotifier=function(){var a=this;return function(b){return b.accept(a)}},x.prototype.asObserver=function(){var a=this;return new t(function(b){a.onNext(b)},function(b){a.onError(b)},function(){a.onCompleted()})};var W=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new V(this._s,a))},b}(s);o.observeOn=function(a){return new W(this,a)};var X=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}function c(a,b){var c=b[0],d=b[1],e=b[2];d.setDisposable(new g(a,c.subscribe(e)))}return N(b,a),b.prototype.subscribeCore=function(a){var b=new F,d=new E;return d.setDisposable(b),b.setDisposable(this._s.schedule([this.source,d,a],c)),d},b}(s);o.subscribeOn=function(a){return new X(this,a)};var Y=function(a){function b(b,c,d,e,f){this._initialState=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._s=f,a.call(this)}function c(a,b){if(a.first)a.first=!1;else if(a.newState=T(a.self._itrFn)(a.newState),a.newState===S)return a.o.onError(a.newState.e);var c=T(a.self._cndFn)(a.newState);if(c===S)return a.o.onError(c.e);if(c){var d=T(a.self._resFn)(a.newState);if(d===S)return a.o.onError(d.e);a.o.onNext(d),b(a)}else a.o.onCompleted()}return N(b,a),b.prototype.subscribeCore=function(a){var b={o:a,self:this,first:!0,newState:this._initialState};return this._s.scheduleRecursive(b,c)},b}(s);n.generate=function(a,b,c,d,e){return P(e)||(e=currentThreadScheduler),new Y(a,b,c,d,e)};var Z=function(a){function b(b,c){this._resFn=b,this._obsFn=c,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){var b=I,c=T(this._resFn)();if(c===S)return new G(q(c.e).subscribe(a),b);c&&(b=c);var d=T(this._obsFn)(c);return d===S?new G(q(d.e).subscribe(a),b):new G(d.subscribe(a),b)},b}(s);n.using=function(a,b){return new Z(a,b)},o.amb=function(a){var b=this;return new r(function(c){function d(){f||(f=g,j.dispose())}function e(){f||(f=h,i.dispose())}var f,g="L",h="R",i=new F,j=new F;L(a)&&(a=Q(a));var k=y(function(a){d(),f===g&&c.onNext(a)},function(a){d(),f===g&&c.onError(a)},function(){d(),f===g&&c.onCompleted()}),l=y(function(a){e(),f===h&&c.onNext(a)},function(a){e(),f===h&&c.onError(a)},function(){e(),f===h&&c.onCompleted()});return i.setDisposable(b.subscribe(k)),j.setDisposable(a.subscribe(l)),new G(i,j)})},n.amb=function(){var a,b=p();if(Array.isArray(arguments[0]))a=arguments[0];else{var c=arguments.length;a=new Array(a);for(var d=0;c>d;d++)a[d]=arguments[d]}for(var d=0,c=a.length;c>d;d++)b=i(b,a[d]);return b},o.onErrorResumeNext=function(a){if(!a)throw new Error("Second observable is required");return aa([this,a])};var $=function(a){function b(b){this.sources=b,a.call(this)}function c(a,b){if(a.pos<a.sources.length){var c=a.sources[a.pos++];L(c)&&(c=Q(c));var d=new F;a.subscription.setDisposable(d),d.setDisposable(c.subscribe(new _(a,b)))}else a.o.onCompleted()}return N(b,a),b.prototype.subscribeCore=function(a){var b=new E,d={pos:0,subscription:b,o:a,sources:this.sources},e=J.scheduleRecursive(d,c);return new G(b,e)},b}(s),_=function(a){function b(b,c){this._state=b,this._recurse=c,a.call(this)}return N(b,a),b.prototype.next=function(a){this._state.o.onNext(a)},b.prototype.error=function(){this._recurse(this._state)},b.prototype.completed=function(){this._recurse(this._state)},b}(z),aa=n.onErrorResumeNext=function(){var a=[];if(Array.isArray(arguments[0]))a=arguments[0];else{var b=arguments.length;a=new Array(b);for(var c=0;b>c;c++)a[c]=arguments[c]}return new $(a)};o.bufferWithCount=function(a,b){return"number"!=typeof b&&(b=a),this.windowWithCount(a,b).flatMap(j).filter(k)},o.windowWithCount=function(a,b){var c=this;if(+a||(a=0),Math.abs(a)===1/0&&(a=0),0>=a)throw new R;if(null==b&&(b=a),+b||(b=0),Math.abs(b)===1/0&&(b=0),0>=b)throw new R;return new r(function(d){function e(){var a=new A;i.push(a),d.onNext(K(a,g))}var f=new F,g=new H(f),h=0,i=[];return e(),f.setDisposable(c.subscribe(function(c){for(var d=0,f=i.length;f>d;d++)i[d].onNext(c);var g=h-a+1;g>=0&&g%b===0&&i.shift().onCompleted(),++h%b===0&&e()},function(a){for(;i.length>0;)i.shift().onError(a);d.onError(a)},function(){for(;i.length>0;)i.shift().onCompleted();d.onCompleted()})),g},c)};var ba=function(a){function b(b,c){this._o=b,this._c=c,this._q=[],a.call(this)}return N(b,a),b.prototype.next=function(a){this._q.push(a),this._q.length>this._c&&this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onNext(this._q),this._o.onCompleted()},b}(z);o.takeLastBuffer=function(a){if(0>a)throw new R;var b=this;return new r(function(c){return b.subscribe(new ba(c,a))},b)};var ca=function(a){function b(b,c){this._o=b,this._d=c,this._f=!1,a.call(this)}return N(b,a),b.prototype.next=function(a){this._f=!0,this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){!this._f&&this._o.onNext(this._d),this._o.onCompleted()},b}(z);o.defaultIfEmpty=function(a){var b=this;return a===d&&(a=null),new r(function(c){return b.subscribe(new ca(c,a))},b)},m.prototype.push=function(a){var b=-1===l(this.set,a,this.comparer);return b&&this.set.push(a),b};var da=function(a){function b(b,c,d){this.source=b,this._keyFn=c,this._cmpFn=d,a.call(this)}return N(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ea(a,this._keyFn,this._cmpFn))},b}(s),ea=function(a){function b(b,c,d){this._o=b,this._keyFn=c,this._h=new m(d),a.call(this)}return N(b,a),b.prototype.next=function(a){var b=a;return M(this._keyFn)&&(b=T(this._keyFn)(a),b===S)?this._o.onError(b.e):void(this._h.push(b)&&this._o.onNext(a))},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(z);return o.distinct=function(a,b){return b||(b=defaultComparer),new da(this,a,b)},o.singleInstance=function(){function a(){return d||(d=!0,b=c["finally"](function(){d=!1}).publish().refCount()),b}var b,c=this,d=!1;return new r(function(b){return a().subscribe(b)})},c}); | ||
//# sourceMappingURL=rx.lite.extras.map |
@@ -169,3 +169,3 @@ // Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. | ||
if (dueTime instanceof Date && period !== undefined) { | ||
return observableTimerDateAndPeriod(dueTime.getTime(), periodOrScheduler, scheduler); | ||
return observableTimerDateAndPeriod(dueTime, periodOrScheduler, scheduler); | ||
} | ||
@@ -297,3 +297,3 @@ return observableTimerTimeSpanAndPeriod(dueTime, period, scheduler); | ||
return new BinaryDisposable(subscription, delays); | ||
}, this); | ||
}, source); | ||
} | ||
@@ -337,3 +337,3 @@ | ||
return new BinaryDisposable( | ||
this.source.subscribe(new DebounceObserver(o, this.source, this._dt, this._s, cancelable)), | ||
this.source.subscribe(new DebounceObserver(o, this._dt, this._s, cancelable)), | ||
cancelable); | ||
@@ -347,5 +347,4 @@ }; | ||
inherits(DebounceObserver, __super__); | ||
function DebounceObserver(observer, source, dueTime, scheduler, cancelable) { | ||
function DebounceObserver(observer, dueTime, scheduler, cancelable) { | ||
this._o = observer; | ||
this._s = source; | ||
this._d = dueTime; | ||
@@ -360,2 +359,7 @@ this._scheduler = scheduler; | ||
function scheduleFuture(s, state) { | ||
state.self._hv && state.self._id === state.currentId && state.self._o.onNext(state.x); | ||
state.self._hv = false; | ||
} | ||
DebounceObserver.prototype.next = function (x) { | ||
@@ -718,34 +722,71 @@ this._hv = true; | ||
function sampleObservable(source, sampler) { | ||
return new AnonymousObservable(function (o) { | ||
var atEnd = false, value, hasValue = false; | ||
var SampleObservable = (function(__super__) { | ||
inherits(SampleObservable, __super__); | ||
function SampleObservable(source, sampler) { | ||
this.source = source; | ||
this._sampler = sampler; | ||
__super__.call(this); | ||
} | ||
function sampleSubscribe() { | ||
if (hasValue) { | ||
hasValue = false; | ||
o.onNext(value); | ||
} | ||
atEnd && o.onCompleted(); | ||
} | ||
SampleObservable.prototype.subscribeCore = function (o) { | ||
var state = { | ||
o: o, | ||
atEnd: false, | ||
value: null, | ||
hasValue: false, | ||
sourceSubscription: new SingleAssignmentDisposable() | ||
}; | ||
var sourceSubscription = new SingleAssignmentDisposable(); | ||
sourceSubscription.setDisposable(source.subscribe( | ||
function (newValue) { | ||
hasValue = true; | ||
value = newValue; | ||
}, | ||
function (e) { o.onError(e); }, | ||
function () { | ||
atEnd = true; | ||
sourceSubscription.dispose(); | ||
} | ||
)); | ||
state.sourceSubscription.setDisposable(this.source.subscribe(new SampleSourceObserver(state))); | ||
return new BinaryDisposable( | ||
sourceSubscription, | ||
sampler.subscribe(sampleSubscribe, function (e) { o.onError(e); }, sampleSubscribe) | ||
state.sourceSubscription, | ||
this._sampler.subscribe(new SamplerObserver(state)) | ||
); | ||
}, source); | ||
} | ||
}; | ||
return SampleObservable; | ||
}(ObservableBase)); | ||
var SamplerObserver = (function(__super__) { | ||
inherits(SamplerObserver, __super__); | ||
function SamplerObserver(s) { | ||
this._s = s; | ||
__super__.call(this); | ||
} | ||
SamplerObserver.prototype._handleMessage = function () { | ||
if (this._s.hasValue) { | ||
this._s.hasValue = false; | ||
this._s.o.onNext(this._s.value); | ||
} | ||
this._s.atEnd && this._s.o.onCompleted(); | ||
}; | ||
SamplerObserver.prototype.next = function () { this._handleMessage(); }; | ||
SamplerObserver.prototype.error = function (e) { this._s.onError(e); }; | ||
SamplerObserver.prototype.completed = function () { this._handleMessage(); }; | ||
return SamplerObserver; | ||
}(AbstractObserver)); | ||
var SampleSourceObserver = (function(__super__) { | ||
inherits(SampleSourceObserver, __super__); | ||
function SampleSourceObserver(s) { | ||
this._s = s; | ||
__super__.call(this); | ||
} | ||
SampleSourceObserver.prototype.next = function (x) { | ||
this._s.hasValue = true; | ||
this._s.value = x; | ||
}; | ||
SampleSourceObserver.prototype.error = function (e) { this._s.o.onError(e); }; | ||
SampleSourceObserver.prototype.completed = function () { | ||
this._s.atEnd = true; | ||
this._s.sourceSubscription.dispose(); | ||
}; | ||
return SampleSourceObserver; | ||
}(AbstractObserver)); | ||
/** | ||
@@ -763,7 +804,7 @@ * Samples the observable sequence at each interval. | ||
*/ | ||
observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) { | ||
observableProto.sample = function (intervalOrSampler, scheduler) { | ||
isScheduler(scheduler) || (scheduler = defaultScheduler); | ||
return typeof intervalOrSampler === 'number' ? | ||
sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) : | ||
sampleObservable(this, intervalOrSampler); | ||
new SampleObservable(this, observableinterval(intervalOrSampler, scheduler)) : | ||
new SampleObservable(this, intervalOrSampler); | ||
}; | ||
@@ -908,26 +949,24 @@ | ||
this._s = s; | ||
this._first = true; | ||
this._hasResult = false; | ||
__super__.call(this); | ||
} | ||
function scheduleRecursive(self, recurse) { | ||
self._hasResult && self._o.onNext(self._state); | ||
function scheduleRecursive(state, recurse) { | ||
state.hasResult && state.o.onNext(state.result); | ||
if (self._first) { | ||
self._first = false; | ||
if (state.first) { | ||
state.first = false; | ||
} else { | ||
self._state = tryCatch(self._itrFn)(self._state); | ||
if (self._state === errorObj) { return self._o.onError(self._state.e); } | ||
state.newState = tryCatch(state.self._itrFn)(state.newState); | ||
if (state.newState === errorObj) { return state.o.onError(state.newState.e); } | ||
} | ||
self._hasResult = tryCatch(self._cndFn)(self._state); | ||
if (self._hasResult === errorObj) { return self._o.onError(self._hasResult.e); } | ||
if (self._hasResult) { | ||
var result = tryCatch(self._resFn)(self._state); | ||
if (result === errorObj) { return self._o.onError(result.e); } | ||
var time = tryCatch(self._timeFn)(self._state); | ||
if (time === errorObj) { return self._o.onError(time.e); } | ||
recurse(self, time); | ||
state.hasResult = tryCatch(state.self._cndFn)(state.newState); | ||
if (state.hasResult === errorObj) { return state.o.onError(state.hasResult.e); } | ||
if (state.hasResult) { | ||
state.result = tryCatch(state.self._resFn)(state.newState); | ||
if (state.result === errorObj) { return state.o.onError(state.result.e); } | ||
var time = tryCatch(state.self._timeFn)(state.newState); | ||
if (time === errorObj) { return state.o.onError(time.e); } | ||
recurse(state, time); | ||
} else { | ||
self._o.onCompleted(); | ||
state.o.onCompleted(); | ||
} | ||
@@ -937,4 +976,10 @@ } | ||
GenerateAbsoluteObservable.prototype.subscribeCore = function (o) { | ||
this._o = o; | ||
return this._s.scheduleRecursiveFuture(this, new Date(this._s.now()), scheduleRecursive); | ||
var state = { | ||
o: o, | ||
self: this, | ||
newState: this._state, | ||
first: true, | ||
hasResult: false | ||
}; | ||
return this._s.scheduleRecursiveFuture(state, new Date(this._s.now()), scheduleRecursive); | ||
}; | ||
@@ -978,26 +1023,25 @@ | ||
this._s = s; | ||
this._first = true; | ||
this._hasResult = false; | ||
__super__.call(this); | ||
} | ||
function scheduleRecursive(self, recurse) { | ||
self._hasResult && self._o.onNext(self._state); | ||
function scheduleRecursive(state, recurse) { | ||
state.hasResult && state.o.onNext(state.result); | ||
if (self._first) { | ||
self._first = false; | ||
if (state.first) { | ||
state.first = false; | ||
} else { | ||
self._state = tryCatch(self._itrFn)(self._state); | ||
if (self._state === errorObj) { return self._o.onError(self._state.e); } | ||
state.newState = tryCatch(state.self._itrFn)(state.newState); | ||
if (state.newState === errorObj) { return state.o.onError(state.newState.e); } | ||
} | ||
self._hasResult = tryCatch(self._cndFn)(self._state); | ||
if (self._hasResult === errorObj) { return self._o.onError(self._hasResult.e); } | ||
if (self._hasResult) { | ||
var result = tryCatch(self._resFn)(self._state); | ||
if (result === errorObj) { return self._o.onError(result.e); } | ||
var time = tryCatch(self._timeFn)(self._state); | ||
if (time === errorObj) { return self._o.onError(time.e); } | ||
recurse(self, time); | ||
state.hasResult = tryCatch(state.self._cndFn)(state.newState); | ||
if (state.hasResult === errorObj) { return state.o.onError(state.hasResult.e); } | ||
if (state.hasResult) { | ||
state.result = tryCatch(state.self._resFn)(state.newState); | ||
if (state.result === errorObj) { return state.o.onError(state.result.e); } | ||
var time = tryCatch(state.self._timeFn)(state.newState); | ||
if (time === errorObj) { return state.o.onError(time.e); } | ||
recurse(state, time); | ||
} else { | ||
self._o.onCompleted(); | ||
state.o.onCompleted(); | ||
} | ||
@@ -1007,4 +1051,10 @@ } | ||
GenerateRelativeObservable.prototype.subscribeCore = function (o) { | ||
this._o = o; | ||
return this._s.scheduleRecursiveFuture(this, 0, scheduleRecursive); | ||
var state = { | ||
o: o, | ||
self: this, | ||
newState: this._state, | ||
first: true, | ||
hasResult: false | ||
}; | ||
return this._s.scheduleRecursiveFuture(state, 0, scheduleRecursive); | ||
}; | ||
@@ -1011,0 +1061,0 @@ |
/* 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 N.e=b,N}}}function f(a,b){return new P(a,b)}function g(a,b,c){return new u(function(d){var e=a,f=H(b);return c.scheduleRecursiveFuture(0,e,function(a,b){if(f>0){var g=c.now();e=new Date(e.getTime()+f),e.getTime()<=g&&(e=new Date(g+f))}d.onNext(a),b(a+1,new Date(e))})})}function h(a,b,c){return a===b?new u(function(a){return c.schedulePeriodic(0,b,function(b){return a.onNext(b),b+1})}):w(function(){return g(new Date(c.now()+a),b,c)})}function i(a,b,c){return new u(function(d){var e,f=!1,g=new B,h=null,i=[],j=!1;return e=a.materialize().timestamp(c).subscribe(function(a){var e,k;"E"===a.value.kind?(i=[],i.push(a),h=a.value.error,k=!j):(i.push({value:a.value,timestamp:a.timestamp+b}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new A,g.setDisposable(e),e.setDisposable(c.scheduleRecursiveFuture(null,b,function(a,b){var e,g,k,l;if(null===h){j=!0;do k=null,i.length>0&&i[0].timestamp-c.now()<=0&&(k=i.shift().value),null!==k&&k.accept(d);while(null!==k);l=!1,g=0,i.length>0?(l=!0,g=Math.max(0,i[0].timestamp-c.now())):f=!1,e=h,j=!1,null!==e?d.onError(e):l&&b(null,g)}}))))}),new D(e,g)},a)}function j(a,b,c){return w(function(){return i(a,b-c.now(),c)})}function k(a,b,c){var d,e;return K(b)?e=b:(d=b,e=c),new u(function(b){function c(){i.setDisposable(a.subscribe(function(a){var c=O(e)(a);if(c===N)return b.onError(c.e);var d=new A;g.add(d),d.setDisposable(c.subscribe(function(){b.onNext(a),g.remove(d),f()},function(a){b.onError(a)},function(){b.onNext(a),g.remove(d),f()}))},function(a){b.onError(a)},function(){h=!0,i.dispose(),f()}))}function f(){h&&0===g.length&&b.onCompleted()}var g=new C,h=!1,i=new B;return d?i.setDisposable(d.subscribe(c,function(a){b.onError(a)},c)):c(),new D(i,g)},this)}function l(a,b){return new u(function(c){var d,e=!1,f=new B,g=0,h=a.subscribe(function(a){var h=O(b)(a);if(h===N)return c.onError(h.e);J(h)&&(h=M(h)),e=!0,d=a,g++;var i=g,j=new A;f.setDisposable(j),j.setDisposable(h.subscribe(function(){e&&g===i&&c.onNext(d),e=!1,j.dispose()},function(a){c.onError(a)},function(){e&&g===i&&c.onNext(d),e=!1,j.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new D(h,f)},a)}function m(a){return a.toArray()}function m(a){return a.toArray()}function n(a,b){return new u(function(c){function d(){g&&(g=!1,c.onNext(e)),f&&c.onCompleted()}var e,f=!1,g=!1,h=new A;return h.setDisposable(a.subscribe(function(a){g=!0,e=a},function(a){c.onError(a)},function(){f=!0,h.dispose()})),new D(h,b.subscribe(d,function(a){c.onError(a)},d))},a)}function o(a,b,c,d){return K(b)&&(d=c,c=b,b=x()),s.isObservable(d)||(d=y(new X)),new u(function(e){function f(a){function b(){return l=c===k}var c=k,f=new A;i.setDisposable(f),f.setDisposable(a.subscribe(function(){b()&&h.setDisposable(d.subscribe(e)),f.dispose()},function(a){b()&&e.onError(a)},function(){b()&&h.setDisposable(d.subscribe(e))}))}function g(){var a=!l;return a&&k++,a}var h=new B,i=new B,j=new A;h.setDisposable(j);var k=0,l=!1;return f(b),j.setDisposable(a.subscribe(function(a){if(g()){e.onNext(a);var b=O(c)(a);if(b===N)return e.onError(b.e);f(J(b)?M(b):b)}},function(a){g()&&e.onError(a)},function(){g()&&e.onCompleted()})),new D(h,i)},a)}function p(a,b,c,d){return L(c)&&(d=c,c=y(new X)),c instanceof Error&&(c=y(c)),L(d)||(d=z),s.isObservable(c)||(c=y(new X)),new u(function(e){function f(){var a=g;k.setDisposable(d.scheduleFuture(null,b,function(){j=g===a,j&&(J(c)&&(c=M(c)),i.setDisposable(c.subscribe(e)))}))}var g=0,h=new A,i=new B,j=!1,k=new B;return i.setDisposable(h),f(),h.setDisposable(a.subscribe(function(a){j||(g++,e.onNext(a),f())},function(a){j||(g++,e.onError(a))},function(){j||(g++,e.onCompleted())})),new D(i,k)},a)}var q=c.internals.inherits,r=c.internals.AbstractObserver,s=c.Observable,t=s.prototype,u=c.AnonymousObservable,v=c.ObservableBase,w=s.defer,x=(s.empty,s.never),y=s["throw"],z=(s.fromArray,c.Scheduler["default"]),A=c.SingleAssignmentDisposable,B=c.SerialDisposable,C=c.CompositeDisposable,D=c.BinaryDisposable,E=c.RefCountDisposable,F=c.Subject,G=c.internals.addRef,H=c.Scheduler.normalize,I=c.helpers,J=I.isPromise,K=I.isFunction,L=c.Scheduler.isScheduler,M=s.fromPromise,N={e:{}},O=c.internals.tryCatch=function(a){if(!K(a))throw new TypeError("fn must be a function");return e(a)},P=function(a){function b(b,c){this._dt=b,this._s=c,a.call(this)}function c(a,b){b.onNext(0),b.onCompleted()}return q(b,a),b.prototype.subscribeCore=function(a){return this._s.scheduleFuture(a,this._dt,c)},b}(v),Q=s.interval=function(a,b){return h(a,a,L(b)?b:z)};s.timer=function(a,b,c){var e;return L(c)||(c=z),null!=b&&"number"==typeof b?e=b:L(b)&&(c=b),(a instanceof Date||"number"==typeof a)&&e===d?f(a,c):a instanceof Date&&e!==d?g(a.getTime(),b,c):h(a,e,c)};t.delay=function(){var a=arguments[0];if("number"==typeof a||a instanceof Date){var b=a,c=arguments[1];return L(c)||(c=z),b instanceof Date?j(this,b,c):i(this,b,c)}if(s.isObservable(a)||K(a))return k(this,a,arguments[1]);throw new Error("Invalid arguments")};var R=function(a){function b(b,c,d){L(d)||(d=z),this.source=b,this._dt=c,this._s=d,a.call(this)}return q(b,a),b.prototype.subscribeCore=function(a){var b=new B;return new D(this.source.subscribe(new S(a,this.source,this._dt,this._s,b)),b)},b}(v),S=function(a){function b(b,c,d,e,f){this._o=b,this._s=c,this._d=d,this._scheduler=e,this._c=f,this._v=null,this._hv=!1,this._id=0,a.call(this)}return q(b,a),b.prototype.next=function(a){this._hv=!0,this._v=a;var b=++this._id,c=new A;this._c.setDisposable(c),c.setDisposable(this._scheduler.scheduleFuture(this,this._d,function(c,d){d._hv&&d._id===b&&d._o.onNext(a),d._hv=!1}))},b.prototype.error=function(a){this._c.dispose(),this._o.onError(a),this._hv=!1,this._id++},b.prototype.completed=function(){this._c.dispose(),this._hv&&this._o.onNext(this._v),this._o.onCompleted(),this._hv=!1,this._id++},b}(r);t.debounce=function(){if(K(arguments[0]))return l(this,arguments[0]);if("number"==typeof arguments[0])return new R(this,arguments[0],arguments[1]);throw new Error("Invalid arguments")},t.windowWithTime=function(a,b,c){var d,e=this;return null==b&&(d=a),L(c)||(c=z),"number"==typeof b?d=b:L(b)&&(d=a,c=b),new u(function(b){function f(){var a=new A,e=!1,g=!1;l.setDisposable(a),j===i?(e=!0,g=!0):i>j?e=!0:g=!0;var n=e?j:i,o=n-m;m=n,e&&(j+=d),g&&(i+=d),a.setDisposable(c.scheduleFuture(null,o,function(){if(g){var a=new F;k.push(a),b.onNext(G(a,h))}e&&k.shift().onCompleted(),f()}))}var g,h,i=d,j=a,k=[],l=new B,m=0;return g=new C(l),h=new E(g),k.push(new F),b.onNext(G(k[0],h)),f(),g.add(e.subscribe(function(a){for(var b=0,c=k.length;c>b;b++)k[b].onNext(a)},function(a){for(var c=0,d=k.length;d>c;c++)k[c].onError(a);b.onError(a)},function(){for(var a=0,c=k.length;c>a;a++)k[a].onCompleted();b.onCompleted()})),h},e)},t.windowWithTimeOrCount=function(a,b,c){var d=this;return L(c)||(c=z),new u(function(e){function f(b){var d=new A;g.setDisposable(d),d.setDisposable(c.scheduleFuture(null,a,function(){if(b===k){j=0;var a=++k;l.onCompleted(),l=new F,e.onNext(G(l,i)),f(a)}}))}var g=new B,h=new C(g),i=new E(h),j=0,k=0,l=new F;return e.onNext(G(l,i)),f(0),h.add(d.subscribe(function(a){var c=0,d=!1;l.onNext(a),++j===b&&(d=!0,j=0,c=++k,l.onCompleted(),l=new F,e.onNext(G(l,i))),d&&f(c)},function(a){l.onError(a),e.onError(a)},function(){l.onCompleted(),e.onCompleted()})),i},d)},t.bufferWithTime=function(a,b,c){return this.windowWithTime(a,b,c).flatMap(m)},t.bufferWithTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).flatMap(m)};var T=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return q(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new U(a,this._s))},b}(v),U=function(a){function b(b,c){this._o=b,this._s=c,this._l=c.now(),a.call(this)}return q(b,a),b.prototype.next=function(a){var b=this._s.now(),c=b-this._l;this._l=b,this._o.onNext({value:a,interval:c})},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(r);t.timeInterval=function(a){return L(a)||(a=z),new T(this,a)};var V=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return q(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new W(a,this._s))},b}(v),W=function(a){function b(b,c){this._o=b,this._s=c,a.call(this)}return q(b,a),b.prototype.next=function(a){this._o.onNext({value:a,timestamp:this._s.now()})},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(r);t.timestamp=function(a){return L(a)||(a=z),new V(this,a)},t.sample=t.throttleLatest=function(a,b){return L(b)||(b=z),"number"==typeof a?n(this,Q(a,b)):n(this,a)};var X=c.TimeoutError=function(a){this.message=a||"Timeout has occurred",this.name="TimeoutError",Error.call(this)};X.prototype=Object.create(Error.prototype),t.timeout=function(){var a=arguments[0];if(a instanceof Date||"number"==typeof a)return p(this,a,arguments[1],arguments[2]);if(s.isObservable(a)||K(a))return o(this,a,arguments[1],arguments[2]);throw new Error("Invalid arguments")};var Y=function(a){function b(b,c,d,e,f,g){this._state=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._timeFn=f,this._s=g,this._first=!0,this._hasResult=!1,a.call(this)}function c(a,b){if(a._hasResult&&a._o.onNext(a._state),a._first)a._first=!1;else if(a._state=O(a._itrFn)(a._state),a._state===N)return a._o.onError(a._state.e);if(a._hasResult=O(a._cndFn)(a._state),a._hasResult===N)return a._o.onError(a._hasResult.e);if(a._hasResult){var c=O(a._resFn)(a._state);if(c===N)return a._o.onError(c.e);var d=O(a._timeFn)(a._state);if(d===N)return a._o.onError(d.e);b(a,d)}else a._o.onCompleted()}return q(b,a),b.prototype.subscribeCore=function(a){return this._o=a,this._s.scheduleRecursiveFuture(this,new Date(this._s.now()),c)},b}(v);s.generateWithAbsoluteTime=function(a,b,c,d,e,f){return L(f)||(f=z),new Y(a,b,c,d,e,f)};var Z=function(a){function b(b,c,d,e,f,g){this._state=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._timeFn=f,this._s=g,this._first=!0,this._hasResult=!1,a.call(this)}function c(a,b){if(a._hasResult&&a._o.onNext(a._state),a._first)a._first=!1;else if(a._state=O(a._itrFn)(a._state),a._state===N)return a._o.onError(a._state.e);if(a._hasResult=O(a._cndFn)(a._state),a._hasResult===N)return a._o.onError(a._hasResult.e);if(a._hasResult){var c=O(a._resFn)(a._state);if(c===N)return a._o.onError(c.e);var d=O(a._timeFn)(a._state);if(d===N)return a._o.onError(d.e);b(a,d)}else a._o.onCompleted()}return q(b,a),b.prototype.subscribeCore=function(a){return this._o=a,this._s.scheduleRecursiveFuture(this,0,c)},b}(v);s.generateWithRelativeTime=function(a,b,c,d,e,f){return L(f)||(f=z),new Z(a,b,c,d,e,f)};var $=function(a){function b(b,c,d){this.source=b,this._dt=c,this._s=d,a.call(this)}function c(a,b){var c=b[0],d=b[1],e=b[2];e.setDisposable(c.subscribe(d))}return q(b,a),b.prototype.subscribeCore=function(a){var b=new B;return b.setDisposable(this._s.scheduleFuture([this.source,a,b],this._dt,c)),b},b}(v);t.delaySubscription=function(a,b){return L(b)||(b=z),new $(this,a,b)};var _=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,a.call(this)}return q(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new aa(a,this))},b}(v),aa=function(a){function b(b,c){this._o=b,this._s=c._s,this._d=c._d,this._q=[],a.call(this)}return q(b,a),b.prototype.next=function(a){var b=this._s.now();for(this._q.push({interval:b,value:a});this._q.length>0&&b-this._q[0].interval>=this._d;)this._o.onNext(this._q.shift().value)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){for(var a=this._s.now();this._q.length>0&&a-this._q[0].interval>=this._d;)this._o.onNext(this._q.shift().value);this._o.onCompleted()},b}(r);t.skipLastWithTime=function(a,b){return L(b)||(b=z),new _(this,a,b)};var ba=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,a.call(this)}return q(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ca(a,this._d,this._s))},b}(v),ca=function(a){function b(b,c,d){this._o=b,this._d=c,this._s=d,this._q=[],a.call(this)}return q(b,a),b.prototype.next=function(a){var b=this._s.now();for(this._q.push({interval:b,value:a});this._q.length>0&&b-this._q[0].interval>=this._d;)this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){for(var a=this._s.now();this._q.length>0;){var b=this._q.shift();a-b.interval<=this._d&&this._o.onNext(b.value)}this._o.onCompleted()},b}(r);t.takeLastWithTime=function(a,b){return L(b)||(b=z),new ba(this,a,b)},t.takeLastBufferWithTime=function(a,b){var c=this;return L(b)||(b=z),new u(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},function(a){d.onError(a)},function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})},c)};var da=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,a.call(this)}function c(a,b){b.onCompleted()}return q(b,a),b.prototype.subscribeCore=function(a){return new D(this._s.scheduleFuture(a,this._d,c),this.source.subscribe(a))},b}(v);t.takeWithTime=function(a,b){return L(b)||(b=z),new da(this,a,b)};var ea=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,this._open=!1,a.call(this)}function c(a,b){b._open=!0}return q(b,a),b.prototype.subscribeCore=function(a){return new D(this._s.scheduleFuture(this,this._d,c),this.source.subscribe(new fa(a,this)))},b}(v),fa=function(a){function b(b,c){this._o=b,this._p=c,a.call(this)}return q(b,a),b.prototype.next=function(a){this._p._open&&this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(r);t.skipWithTime=function(a,b){return L(b)||(b=z),new ea(this,a,b)};var ga=function(a){function b(b,c,d){this.source=b,this._st=c,this._s=d,a.call(this)}function c(a,b){b._open=!0}return q(b,a),b.prototype.subscribeCore=function(a){return this._open=!1,new D(this._s.scheduleFuture(this,this._st,c),this.source.subscribe(new ha(a,this)))},b}(v),ha=function(a){function b(b,c){this._o=b,this._p=c,a.call(this)}return q(b,a),b.prototype.next=function(a){this._p._open&&this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(r);return t.skipUntilWithTime=function(a,b){return L(b)||(b=z),new ga(this,a,b)},t.takeUntilWithTime=function(a,b){L(b)||(b=z);var c=this;return new u(function(d){return new D(b.scheduleFuture(d,a,function(a,b){b.onCompleted()}),c.subscribe(d))},c)},t.throttle=function(a,b){L(b)||(b=z);var c=+a||0;if(0>=c)throw new RangeError("windowDuration cannot be less or equal zero.");var d=this;return new u(function(a){var e=0;return d.subscribe(function(d){var f=b.now();(0===e||f-e>=c)&&(e=f,a.onNext(d))},function(b){a.onError(b)},function(){a.onCompleted()})},d)},c}); | ||
(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 M.e=b,M}}}function f(a,b){return new O(a,b)}function g(a,b,c){return new t(function(d){var e=a,f=G(b);return c.scheduleRecursiveFuture(0,e,function(a,b){if(f>0){var g=c.now();e=new Date(e.getTime()+f),e.getTime()<=g&&(e=new Date(g+f))}d.onNext(a),b(a+1,new Date(e))})})}function h(a,b,c){return a===b?new t(function(a){return c.schedulePeriodic(0,b,function(b){return a.onNext(b),b+1})}):v(function(){return g(new Date(c.now()+a),b,c)})}function i(a,b,c){return new t(function(d){var e,f=!1,g=new A,h=null,i=[],j=!1;return e=a.materialize().timestamp(c).subscribe(function(a){var e,k;"E"===a.value.kind?(i=[],i.push(a),h=a.value.error,k=!j):(i.push({value:a.value,timestamp:a.timestamp+b}),k=!f,f=!0),k&&(null!==h?d.onError(h):(e=new z,g.setDisposable(e),e.setDisposable(c.scheduleRecursiveFuture(null,b,function(a,b){var e,g,k,l;if(null===h){j=!0;do k=null,i.length>0&&i[0].timestamp-c.now()<=0&&(k=i.shift().value),null!==k&&k.accept(d);while(null!==k);l=!1,g=0,i.length>0?(l=!0,g=Math.max(0,i[0].timestamp-c.now())):f=!1,e=h,j=!1,null!==e?d.onError(e):l&&b(null,g)}}))))}),new C(e,g)},a)}function j(a,b,c){return v(function(){return i(a,b-c.now(),c)})}function k(a,b,c){var d,e;return J(b)?e=b:(d=b,e=c),new t(function(b){function c(){i.setDisposable(a.subscribe(function(a){var c=N(e)(a);if(c===M)return b.onError(c.e);var d=new z;g.add(d),d.setDisposable(c.subscribe(function(){b.onNext(a),g.remove(d),f()},function(a){b.onError(a)},function(){b.onNext(a),g.remove(d),f()}))},function(a){b.onError(a)},function(){h=!0,i.dispose(),f()}))}function f(){h&&0===g.length&&b.onCompleted()}var g=new B,h=!1,i=new A;return d?i.setDisposable(d.subscribe(c,function(a){b.onError(a)},c)):c(),new C(i,g)},a)}function l(a,b){return new t(function(c){var d,e=!1,f=new A,g=0,h=a.subscribe(function(a){var h=N(b)(a);if(h===M)return c.onError(h.e);I(h)&&(h=L(h)),e=!0,d=a,g++;var i=g,j=new z;f.setDisposable(j),j.setDisposable(h.subscribe(function(){e&&g===i&&c.onNext(d),e=!1,j.dispose()},function(a){c.onError(a)},function(){e&&g===i&&c.onNext(d),e=!1,j.dispose()}))},function(a){f.dispose(),c.onError(a),e=!1,g++},function(){f.dispose(),e&&c.onNext(d),c.onCompleted(),e=!1,g++});return new C(h,f)},a)}function m(a){return a.toArray()}function m(a){return a.toArray()}function n(a,b,c,d){return J(b)&&(d=c,c=b,b=w()),r.isObservable(d)||(d=x(new Z)),new t(function(e){function f(a){function b(){return l=c===k}var c=k,f=new z;i.setDisposable(f),f.setDisposable(a.subscribe(function(){b()&&h.setDisposable(d.subscribe(e)),f.dispose()},function(a){b()&&e.onError(a)},function(){b()&&h.setDisposable(d.subscribe(e))}))}function g(){var a=!l;return a&&k++,a}var h=new A,i=new A,j=new z;h.setDisposable(j);var k=0,l=!1;return f(b),j.setDisposable(a.subscribe(function(a){if(g()){e.onNext(a);var b=N(c)(a);if(b===M)return e.onError(b.e);f(I(b)?L(b):b)}},function(a){g()&&e.onError(a)},function(){g()&&e.onCompleted()})),new C(h,i)},a)}function o(a,b,c,d){return K(c)&&(d=c,c=x(new Z)),c instanceof Error&&(c=x(c)),K(d)||(d=y),r.isObservable(c)||(c=x(new Z)),new t(function(e){function f(){var a=g;k.setDisposable(d.scheduleFuture(null,b,function(){j=g===a,j&&(I(c)&&(c=L(c)),i.setDisposable(c.subscribe(e)))}))}var g=0,h=new z,i=new A,j=!1,k=new A;return i.setDisposable(h),f(),h.setDisposable(a.subscribe(function(a){j||(g++,e.onNext(a),f())},function(a){j||(g++,e.onError(a))},function(){j||(g++,e.onCompleted())})),new C(i,k)},a)}var p=c.internals.inherits,q=c.internals.AbstractObserver,r=c.Observable,s=r.prototype,t=c.AnonymousObservable,u=c.ObservableBase,v=r.defer,w=(r.empty,r.never),x=r["throw"],y=(r.fromArray,c.Scheduler["default"]),z=c.SingleAssignmentDisposable,A=c.SerialDisposable,B=c.CompositeDisposable,C=c.BinaryDisposable,D=c.RefCountDisposable,E=c.Subject,F=c.internals.addRef,G=c.Scheduler.normalize,H=c.helpers,I=H.isPromise,J=H.isFunction,K=c.Scheduler.isScheduler,L=r.fromPromise,M={e:{}},N=c.internals.tryCatch=function(a){if(!J(a))throw new TypeError("fn must be a function");return e(a)},O=function(a){function b(b,c){this._dt=b,this._s=c,a.call(this)}function c(a,b){b.onNext(0),b.onCompleted()}return p(b,a),b.prototype.subscribeCore=function(a){return this._s.scheduleFuture(a,this._dt,c)},b}(u),P=r.interval=function(a,b){return h(a,a,K(b)?b:y)};r.timer=function(a,b,c){var e;return K(c)||(c=y),null!=b&&"number"==typeof b?e=b:K(b)&&(c=b),(a instanceof Date||"number"==typeof a)&&e===d?f(a,c):a instanceof Date&&e!==d?g(a,b,c):h(a,e,c)};s.delay=function(){var a=arguments[0];if("number"==typeof a||a instanceof Date){var b=a,c=arguments[1];return K(c)||(c=y),b instanceof Date?j(this,b,c):i(this,b,c)}if(r.isObservable(a)||J(a))return k(this,a,arguments[1]);throw new Error("Invalid arguments")};var Q=function(a){function b(b,c,d){K(d)||(d=y),this.source=b,this._dt=c,this._s=d,a.call(this)}return p(b,a),b.prototype.subscribeCore=function(a){var b=new A;return new C(this.source.subscribe(new R(a,this._dt,this._s,b)),b)},b}(u),R=function(a){function b(b,c,d,e){this._o=b,this._d=c,this._scheduler=d,this._c=e,this._v=null,this._hv=!1,this._id=0,a.call(this)}return p(b,a),b.prototype.next=function(a){this._hv=!0,this._v=a;var b=++this._id,c=new z;this._c.setDisposable(c),c.setDisposable(this._scheduler.scheduleFuture(this,this._d,function(c,d){d._hv&&d._id===b&&d._o.onNext(a),d._hv=!1}))},b.prototype.error=function(a){this._c.dispose(),this._o.onError(a),this._hv=!1,this._id++},b.prototype.completed=function(){this._c.dispose(),this._hv&&this._o.onNext(this._v),this._o.onCompleted(),this._hv=!1,this._id++},b}(q);s.debounce=function(){if(J(arguments[0]))return l(this,arguments[0]);if("number"==typeof arguments[0])return new Q(this,arguments[0],arguments[1]);throw new Error("Invalid arguments")},s.windowWithTime=function(a,b,c){var d,e=this;return null==b&&(d=a),K(c)||(c=y),"number"==typeof b?d=b:K(b)&&(d=a,c=b),new t(function(b){function f(){var a=new z,e=!1,g=!1;l.setDisposable(a),j===i?(e=!0,g=!0):i>j?e=!0:g=!0;var n=e?j:i,o=n-m;m=n,e&&(j+=d),g&&(i+=d),a.setDisposable(c.scheduleFuture(null,o,function(){if(g){var a=new E;k.push(a),b.onNext(F(a,h))}e&&k.shift().onCompleted(),f()}))}var g,h,i=d,j=a,k=[],l=new A,m=0;return g=new B(l),h=new D(g),k.push(new E),b.onNext(F(k[0],h)),f(),g.add(e.subscribe(function(a){for(var b=0,c=k.length;c>b;b++)k[b].onNext(a)},function(a){for(var c=0,d=k.length;d>c;c++)k[c].onError(a);b.onError(a)},function(){for(var a=0,c=k.length;c>a;a++)k[a].onCompleted();b.onCompleted()})),h},e)},s.windowWithTimeOrCount=function(a,b,c){var d=this;return K(c)||(c=y),new t(function(e){function f(b){var d=new z;g.setDisposable(d),d.setDisposable(c.scheduleFuture(null,a,function(){if(b===k){j=0;var a=++k;l.onCompleted(),l=new E,e.onNext(F(l,i)),f(a)}}))}var g=new A,h=new B(g),i=new D(h),j=0,k=0,l=new E;return e.onNext(F(l,i)),f(0),h.add(d.subscribe(function(a){var c=0,d=!1;l.onNext(a),++j===b&&(d=!0,j=0,c=++k,l.onCompleted(),l=new E,e.onNext(F(l,i))),d&&f(c)},function(a){l.onError(a),e.onError(a)},function(){l.onCompleted(),e.onCompleted()})),i},d)},s.bufferWithTime=function(a,b,c){return this.windowWithTime(a,b,c).flatMap(m)},s.bufferWithTimeOrCount=function(a,b,c){return this.windowWithTimeOrCount(a,b,c).flatMap(m)};var S=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return p(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new T(a,this._s))},b}(u),T=function(a){function b(b,c){this._o=b,this._s=c,this._l=c.now(),a.call(this)}return p(b,a),b.prototype.next=function(a){var b=this._s.now(),c=b-this._l;this._l=b,this._o.onNext({value:a,interval:c})},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(q);s.timeInterval=function(a){return K(a)||(a=y),new S(this,a)};var U=function(a){function b(b,c){this.source=b,this._s=c,a.call(this)}return p(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new V(a,this._s))},b}(u),V=function(a){function b(b,c){this._o=b,this._s=c,a.call(this)}return p(b,a),b.prototype.next=function(a){this._o.onNext({value:a,timestamp:this._s.now()})},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(q);s.timestamp=function(a){return K(a)||(a=y),new U(this,a)};var W=function(a){function b(b,c){this.source=b,this._sampler=c,a.call(this)}return p(b,a),b.prototype.subscribeCore=function(a){var b={o:a,atEnd:!1,value:null,hasValue:!1,sourceSubscription:new z};return b.sourceSubscription.setDisposable(this.source.subscribe(new Y(b))),new C(b.sourceSubscription,this._sampler.subscribe(new X(b)))},b}(u),X=function(a){function b(b){this._s=b,a.call(this)}return p(b,a),b.prototype._handleMessage=function(){this._s.hasValue&&(this._s.hasValue=!1,this._s.o.onNext(this._s.value)),this._s.atEnd&&this._s.o.onCompleted()},b.prototype.next=function(){this._handleMessage()},b.prototype.error=function(a){this._s.onError(a)},b.prototype.completed=function(){this._handleMessage()},b}(q),Y=function(a){function b(b){this._s=b,a.call(this)}return p(b,a),b.prototype.next=function(a){this._s.hasValue=!0,this._s.value=a},b.prototype.error=function(a){this._s.o.onError(a)},b.prototype.completed=function(){this._s.atEnd=!0,this._s.sourceSubscription.dispose()},b}(q);s.sample=function(a,b){return K(b)||(b=y),"number"==typeof a?new W(this,P(a,b)):new W(this,a)};var Z=c.TimeoutError=function(a){this.message=a||"Timeout has occurred",this.name="TimeoutError",Error.call(this)};Z.prototype=Object.create(Error.prototype),s.timeout=function(){var a=arguments[0];if(a instanceof Date||"number"==typeof a)return o(this,a,arguments[1],arguments[2]);if(r.isObservable(a)||J(a))return n(this,a,arguments[1],arguments[2]);throw new Error("Invalid arguments")};var $=function(a){function b(b,c,d,e,f,g){this._state=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._timeFn=f,this._s=g,a.call(this)}function c(a,b){if(a.hasResult&&a.o.onNext(a.result),a.first)a.first=!1;else if(a.newState=N(a.self._itrFn)(a.newState),a.newState===M)return a.o.onError(a.newState.e);if(a.hasResult=N(a.self._cndFn)(a.newState),a.hasResult===M)return a.o.onError(a.hasResult.e);if(a.hasResult){if(a.result=N(a.self._resFn)(a.newState),a.result===M)return a.o.onError(a.result.e);var c=N(a.self._timeFn)(a.newState);if(c===M)return a.o.onError(c.e);b(a,c)}else a.o.onCompleted()}return p(b,a),b.prototype.subscribeCore=function(a){var b={o:a,self:this,newState:this._state,first:!0,hasResult:!1};return this._s.scheduleRecursiveFuture(b,new Date(this._s.now()),c)},b}(u);r.generateWithAbsoluteTime=function(a,b,c,d,e,f){return K(f)||(f=y),new $(a,b,c,d,e,f)};var _=function(a){function b(b,c,d,e,f,g){this._state=b,this._cndFn=c,this._itrFn=d,this._resFn=e,this._timeFn=f,this._s=g,a.call(this)}function c(a,b){if(a.hasResult&&a.o.onNext(a.result),a.first)a.first=!1;else if(a.newState=N(a.self._itrFn)(a.newState),a.newState===M)return a.o.onError(a.newState.e);if(a.hasResult=N(a.self._cndFn)(a.newState),a.hasResult===M)return a.o.onError(a.hasResult.e);if(a.hasResult){if(a.result=N(a.self._resFn)(a.newState),a.result===M)return a.o.onError(a.result.e);var c=N(a.self._timeFn)(a.newState);if(c===M)return a.o.onError(c.e);b(a,c)}else a.o.onCompleted()}return p(b,a),b.prototype.subscribeCore=function(a){var b={o:a,self:this,newState:this._state,first:!0,hasResult:!1};return this._s.scheduleRecursiveFuture(b,0,c)},b}(u);r.generateWithRelativeTime=function(a,b,c,d,e,f){return K(f)||(f=y),new _(a,b,c,d,e,f)};var aa=function(a){function b(b,c,d){this.source=b,this._dt=c,this._s=d,a.call(this)}function c(a,b){var c=b[0],d=b[1],e=b[2];e.setDisposable(c.subscribe(d))}return p(b,a),b.prototype.subscribeCore=function(a){var b=new A;return b.setDisposable(this._s.scheduleFuture([this.source,a,b],this._dt,c)),b},b}(u);s.delaySubscription=function(a,b){return K(b)||(b=y),new aa(this,a,b)};var ba=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,a.call(this)}return p(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ca(a,this))},b}(u),ca=function(a){function b(b,c){this._o=b,this._s=c._s,this._d=c._d,this._q=[],a.call(this)}return p(b,a),b.prototype.next=function(a){var b=this._s.now();for(this._q.push({interval:b,value:a});this._q.length>0&&b-this._q[0].interval>=this._d;)this._o.onNext(this._q.shift().value)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){for(var a=this._s.now();this._q.length>0&&a-this._q[0].interval>=this._d;)this._o.onNext(this._q.shift().value);this._o.onCompleted()},b}(q);s.skipLastWithTime=function(a,b){return K(b)||(b=y),new ba(this,a,b)};var da=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,a.call(this)}return p(b,a),b.prototype.subscribeCore=function(a){return this.source.subscribe(new ea(a,this._d,this._s))},b}(u),ea=function(a){function b(b,c,d){this._o=b,this._d=c,this._s=d,this._q=[],a.call(this)}return p(b,a),b.prototype.next=function(a){var b=this._s.now();for(this._q.push({interval:b,value:a});this._q.length>0&&b-this._q[0].interval>=this._d;)this._q.shift()},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){for(var a=this._s.now();this._q.length>0;){var b=this._q.shift();a-b.interval<=this._d&&this._o.onNext(b.value)}this._o.onCompleted()},b}(q);s.takeLastWithTime=function(a,b){return K(b)||(b=y),new da(this,a,b)},s.takeLastBufferWithTime=function(a,b){var c=this;return K(b)||(b=y),new t(function(d){var e=[];return c.subscribe(function(c){var d=b.now();for(e.push({interval:d,value:c});e.length>0&&d-e[0].interval>=a;)e.shift()},function(a){d.onError(a)},function(){for(var c=b.now(),f=[];e.length>0;){var g=e.shift();c-g.interval<=a&&f.push(g.value)}d.onNext(f),d.onCompleted()})},c)};var fa=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,a.call(this)}function c(a,b){b.onCompleted()}return p(b,a),b.prototype.subscribeCore=function(a){return new C(this._s.scheduleFuture(a,this._d,c),this.source.subscribe(a))},b}(u);s.takeWithTime=function(a,b){return K(b)||(b=y),new fa(this,a,b)};var ga=function(a){function b(b,c,d){this.source=b,this._d=c,this._s=d,this._open=!1,a.call(this)}function c(a,b){b._open=!0}return p(b,a),b.prototype.subscribeCore=function(a){return new C(this._s.scheduleFuture(this,this._d,c),this.source.subscribe(new ha(a,this)))},b}(u),ha=function(a){function b(b,c){this._o=b,this._p=c,a.call(this)}return p(b,a),b.prototype.next=function(a){this._p._open&&this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(q);s.skipWithTime=function(a,b){return K(b)||(b=y),new ga(this,a,b)};var ia=function(a){function b(b,c,d){this.source=b,this._st=c,this._s=d,a.call(this)}function c(a,b){b._open=!0}return p(b,a),b.prototype.subscribeCore=function(a){return this._open=!1,new C(this._s.scheduleFuture(this,this._st,c),this.source.subscribe(new ja(a,this)))},b}(u),ja=function(a){function b(b,c){this._o=b,this._p=c,a.call(this)}return p(b,a),b.prototype.next=function(a){this._p._open&&this._o.onNext(a)},b.prototype.error=function(a){this._o.onError(a)},b.prototype.completed=function(){this._o.onCompleted()},b}(q);return s.skipUntilWithTime=function(a,b){return K(b)||(b=y),new ia(this,a,b)},s.takeUntilWithTime=function(a,b){K(b)||(b=y);var c=this;return new t(function(d){return new C(b.scheduleFuture(d,a,function(a,b){b.onCompleted()}),c.subscribe(d))},c)},s.throttle=function(a,b){K(b)||(b=y);var c=+a||0;if(0>=c)throw new RangeError("windowDuration cannot be less or equal zero.");var d=this;return new t(function(a){var e=0;return d.subscribe(function(d){var f=b.now();(0===e||f-e>=c)&&(e=f,a.onNext(d))},function(b){a.onError(b)},function(){a.onCompleted()})},d)},c}); | ||
//# sourceMappingURL=rx.time.map |
@@ -5,3 +5,3 @@ { | ||
"description": "Library for composing asynchronous and event-based operations in JavaScript", | ||
"version": "4.0.7", | ||
"version": "4.0.8", | ||
"homepage": "https://github.com/Reactive-Extensions/RxJS", | ||
@@ -8,0 +8,0 @@ "author": { |
@@ -35,3 +35,3 @@ [![Build Status](https://travis-ci.org/Reactive-Extensions/RxJS.svg)](https://travis-ci.org/Reactive-Extensions/RxJS) | ||
Whether you are authoring a web-based application in JavaScript or a server-side application in Node.js, you have to deal with asynchronous and event-based programming as a matter of course. Although some patterns are emerging such as the Promise pattern, handling exceptions, cancellation, and synchronization is difficult and error-prone. | ||
Whether you are authoring a web-based application in JavaScript or a server-side application in Node.js, you have to deal with asynchronous and event-based programming. Although some patterns are emerging such as the Promise pattern, handling exceptions, cancellation, and synchronization is difficult and error-prone. | ||
@@ -42,40 +42,27 @@ Using RxJS, you can represent multiple asynchronous data streams (that come from diverse sources, e.g., stock quote, tweets, computer events, web service requests, etc.), and subscribe to the event stream using the Observer object. The Observable notifies the subscribed Observer instance whenever an event occurs. | ||
But the best news of all is that you already know how to program like this. Take for example the following JavaScript code, where we get some stock data and then manipulate and then iterate the results. | ||
But the best news of all is that you already know how to program like this. Take for example the following JavaScript code, where we get some stock data and then manipulate and iterate the results. | ||
```js | ||
/* Get stock data somehow */ | ||
var source = getStockData(); | ||
const source = getAsyncStockData(); | ||
source | ||
.filter(function (quote) { | ||
return quote.price > 30; | ||
}) | ||
.map(function (quote) { | ||
return quote.price; | ||
}) | ||
.forEach(function (price) { | ||
console.log('Prices higher than $30: $' + price); | ||
}); | ||
const subscription = source | ||
.filter(quote => quote.price > 30) | ||
.map(quote => quote.price) | ||
.forEach(price => console.log(`Prices higher than $30: ${price}`); | ||
``` | ||
Now what if this data were to come as some sort of event, for example a stream, such as a WebSocket, then we could pretty much write the same query to iterate our data, with very little change. | ||
Now what if this data were to come as some sort of event, for example a stream, such as a WebSocket? Then we could pretty much write the same query to iterate our data, with very little change. | ||
```js | ||
/* Get stock data somehow */ | ||
var source = getAsyncStockData(); | ||
const source = getAsyncStockData(); | ||
var subscription = source | ||
.filter(function (quote) { | ||
return quote.price > 30; | ||
}) | ||
.map(function (quote) { | ||
return quote.price; | ||
}) | ||
const subscription = source | ||
.filter(quote => quote.price > 30) | ||
.map(quote => quote.price) | ||
.subscribe( | ||
function (price) { | ||
console.log('Prices higher than $30: $' + price); | ||
}, | ||
function (err) { | ||
console.log('Something went wrong: ' + err.message); | ||
}); | ||
price => console.log(`Prices higher than $30: ${price}`), | ||
err => console.log(`Something went wrong: ${err.message}`); | ||
); | ||
@@ -128,5 +115,5 @@ /* When we're done */ | ||
One question you may ask yourself, is why RxJS? What about Promises? Promises are good for solving asynchronous operations such as querying a service with an XMLHttpRequest, where the expected behavior is one value and then completion. The Reactive Extensions for JavaScript unifies both the world of Promises, callbacks as well as evented data such as DOM Input, Web Workers, Web Sockets. Once we have unified these concepts, this enables rich composition. | ||
One question you may ask yourself is why RxJS? What about Promises? Promises are good for solving asynchronous operations such as querying a service with an XMLHttpRequest, where the expected behavior is one value and then completion. Reactive Extensions for JavaScript unify both the world of Promises, callbacks as well as evented data such as DOM Input, Web Workers, and Web Sockets. Unifying these concepts enables rich composition. | ||
To give you an idea about rich composition, we can create an autocompletion service which takes the user input from a text input and then query a service, making sure not to flood the service with calls for every key stroke, but instead allow to go at a more natural pace. | ||
To give you an idea about rich composition, we can create an autocompletion service which takes user input from a text input and then throttles queries a service (to avoid flooding the service with calls for every key stroke). | ||
@@ -141,4 +128,4 @@ First, we'll reference the JavaScript files, including jQuery, although RxJS has no dependencies on jQuery... | ||
```js | ||
var $input = $('#input'), | ||
$results = $('#results'); | ||
const $input = $('#input'); | ||
const $results = $('#results'); | ||
@@ -148,5 +135,3 @@ /* Only get the value from each key up */ | ||
.pluck('target', 'value') | ||
.filter(function (text) { | ||
return text.length > 2; | ||
}); | ||
.filter(text => text.length > 2 ); | ||
@@ -162,3 +147,3 @@ /* Now debounce the input for 500ms */ | ||
Now, let's query Wikipedia! In RxJS, we can instantly bind to any [Promises A+](https://github.com/promises-aplus/promises-spec) implementation through the `Rx.Observable.fromPromise` method or by just directly returning it, and we wrap it for you. | ||
Now, let's query Wikipedia! In RxJS, we can instantly bind to any [Promises A+](https://github.com/promises-aplus/promises-spec) implementation through the `Rx.Observable.fromPromise` method. Or, directly return it and RxJS will wrap it for you. | ||
@@ -179,3 +164,3 @@ ```js | ||
Once that is created, now we can tie together the distinct throttled input and then query the service. In this case, we'll call `flatMapLatest` to get the value and ensure that we're not introducing any out of order sequence calls. | ||
Once that is created, we can tie together the distinct throttled input and query the service. In this case, we'll call `flatMapLatest` to get the value and ensure we're not introducing any out of order sequence calls. | ||
@@ -191,10 +176,8 @@ ```js | ||
suggestions.subscribe( | ||
function (data) { | ||
data => { | ||
$results | ||
.empty() | ||
.append ($.map(data[1], function (value) { | ||
return $('<li>').text(value); | ||
})); | ||
.append($.map(data[1], value => $('<li>').text(value))) | ||
}, | ||
function (error) { | ||
error=> { | ||
$results | ||
@@ -258,6 +241,7 @@ .empty() | ||
- [Programming Reactive Extensions and LINQ](http://www.amazon.com/Programming-Reactive-Extensions-Jesse-Liberty/dp/1430237473/) | ||
- [Reactive Programming with RxJS](https://pragprog.com/book/smreactjs/reactive-programming-with-rxjs) | ||
- [Community Examples](examples/community.md) | ||
- [Presentations](doc/presentations.md) | ||
- [Videos and Podcasts](doc/videos.md) | ||
- [Presentations](examples/presentations.md) | ||
- [Videos and Podcasts](examples/videos.md) | ||
@@ -361,5 +345,5 @@ ## Getting Started | ||
}, | ||
['rx'], function(Rx) { | ||
var obs = Rx.Observable.of(42); | ||
obs.forEach(function (x) { console.log(x); }); | ||
['rx'], (Rx) => { | ||
const obs = Rx.Observable.of(42); | ||
obs.forEach(x => console.log(x)); | ||
}); | ||
@@ -370,3 +354,3 @@ ``` | ||
The Reactive Extensions for JavaScript have no external dependencies any library, so they'll work well with just about any library. We provide bridges and support for various libraries including: | ||
The Reactive Extensions for JavaScript have no external dependencies on any library, so they'll work well with just about any library. We provide bridges and support for various libraries including: | ||
- [Node.js](https://www.npmjs.com/package/rx-node) | ||
@@ -402,2 +386,4 @@ - [React](http://facebook.github.io/react/) | ||
First-time contributors must sign a [Contribution License Agreement](https://cla.microsoft.com/). If your Pull Request has the label [cla-required](https://github.com/Reactive-Extensions/RxJS/labels/cla-required), this is an indication that you haven't yet signed such an agreement. | ||
## License ## | ||
@@ -404,0 +390,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6585761
93052
394