rxjs-rails 2.2.15 → 2.2.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -33,48 +33,56 @@
33
33
  }
34
34
  }.call(this, function (root, exp, Rx, undefined) {
35
35
 
36
- // Aliases
37
- var Observable = Rx.Observable,
38
- observableProto = Observable.prototype,
39
- AnonymousObservable = Rx.AnonymousObservable,
40
- observableConcat = Observable.concat,
41
- observableDefer = Observable.defer,
42
- observableEmpty = Observable.empty,
43
- disposableEmpty = Rx.Disposable.empty,
44
- CompositeDisposable = Rx.CompositeDisposable,
45
- SerialDisposable = Rx.SerialDisposable,
46
- SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
47
- enumeratorCreate = Rx.internals.Enumerator.create,
48
- Enumerable = Rx.internals.Enumerable,
49
- enumerableForEach = Enumerable.forEach,
50
- immediateScheduler = Rx.Scheduler.immediate,
51
- currentThreadScheduler = Rx.Scheduler.currentThread,
52
- slice = Array.prototype.slice,
53
- AsyncSubject = Rx.AsyncSubject,
54
- Observer = Rx.Observer,
55
- inherits = Rx.internals.inherits,
56
- addProperties = Rx.internals.addProperties;
57
-
58
- // Utilities
59
- function nothing () { }
60
- function argsOrArray(args, idx) {
61
- return args.length === 1 && Array.isArray(args[idx]) ?
62
- args[idx] :
63
- slice.call(args);
64
- }
65
-
66
- function enumerableWhile(condition, source) {
67
- return new Enumerable(function () {
68
- var current;
69
- return enumeratorCreate(function () {
70
- if (condition()) {
71
- current = source;
72
- return true;
73
- }
74
- return false;
75
- }, function () { return current; });
76
- });
77
- }
36
+ // Aliases
37
+ var Observable = Rx.Observable,
38
+ observableProto = Observable.prototype,
39
+ AnonymousObservable = Rx.AnonymousObservable,
40
+ observableConcat = Observable.concat,
41
+ observableDefer = Observable.defer,
42
+ observableEmpty = Observable.empty,
43
+ disposableEmpty = Rx.Disposable.empty,
44
+ CompositeDisposable = Rx.CompositeDisposable,
45
+ SerialDisposable = Rx.SerialDisposable,
46
+ SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
47
+ Enumerator = Rx.internals.Enumerator,
48
+ Enumerable = Rx.internals.Enumerable,
49
+ enumerableForEach = Enumerable.forEach,
50
+ immediateScheduler = Rx.Scheduler.immediate,
51
+ currentThreadScheduler = Rx.Scheduler.currentThread,
52
+ slice = Array.prototype.slice,
53
+ AsyncSubject = Rx.AsyncSubject,
54
+ Observer = Rx.Observer,
55
+ inherits = Rx.internals.inherits,
56
+ addProperties = Rx.internals.addProperties;
57
+
58
+ // Utilities
59
+ function nothing () { }
60
+ function argsOrArray(args, idx) {
61
+ return args.length === 1 && Array.isArray(args[idx]) ?
62
+ args[idx] :
63
+ slice.call(args);
64
+ }
65
+
66
+ // Shim in iterator support
67
+ var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) ||
68
+ '_es6shim_iterator_';
69
+ // Firefox ships a partial implementation using the name @@iterator.
70
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14
71
+ // So use that name if we detect it.
72
+ if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
73
+ $iterator$ = '@@iterator';
74
+ }
75
+ var doneEnumerator = { done: true, value: undefined };
76
+
77
+ function enumerableWhile(condition, source) {
78
+ return new Enumerable(function () {
79
+ return new Enumerator(function () {
80
+ return condition() ?
81
+ { done: false, value: source } :
82
+ { done: true, value: undefined };
83
+ });
84
+ });
85
+ }
78
86
 
79
87
  /**
80
88
  * Returns an observable sequence that is the result of invoking the selector on the source sequence, without sharing subscriptions.
@@ -1 +1 @@
1
- (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(){}function f(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:w.call(a)}function g(a,b){return new s(function(){var c;return r(function(){return a()?(c=b,!0):!1},function(){return c})})}var h=c.Observable,i=h.prototype,j=c.AnonymousObservable,k=h.concat,l=h.defer,m=h.empty,n=c.Disposable.empty,o=c.CompositeDisposable,p=c.SerialDisposable,q=c.SingleAssignmentDisposable,r=c.internals.Enumerator.create,s=c.internals.Enumerable,t=s.forEach,u=c.Scheduler.immediate,v=c.Scheduler.currentThread,w=Array.prototype.slice,x=c.AsyncSubject,y=c.Observer,z=c.internals.inherits,A=c.internals.addProperties;i.letBind=i.let=function(a){return a(this)},h["if"]=h.ifThen=function(a,b,c){return l(function(){if(c||(c=m()),c.now){var d=c;c=m(d)}return a()?b:c})},h["for"]=h.forIn=function(a,b){return t(a,b).concat()};var B=h["while"]=h.whileDo=function(a,b){return g(a,b).concat()};i.doWhile=function(a){return k([this,B(a,this)])},h["case"]=h.switchCase=function(a,b,c){return l(function(){if(c||(c=m()),c.now){var e=c;c=m(e)}var f=b[a()];return f!==d?f:c})},i.expand=function(a,b){b||(b=u);var c=this;return new j(function(d){var e=[],f=new p,g=new o(f),h=0,i=!1,j=function(){var c=!1;e.length>0&&(c=!i,i=!0),c&&f.setDisposable(b.scheduleRecursive(function(b){var c;if(!(e.length>0))return i=!1,void 0;c=e.shift();var f=new q;g.add(f),f.setDisposable(c.subscribe(function(b){d.onNext(b);var c=null;try{c=a(b)}catch(f){d.onError(f)}e.push(c),h++,j()},d.onError.bind(d),function(){g.remove(f),h--,0===h&&d.onCompleted()})),b()}))};return e.push(c),h++,j(),g})},h.forkJoin=function(){var a=f(arguments,0);return new j(function(b){var c=a.length;if(0===c)return b.onCompleted(),n;for(var d=new o,e=!1,f=new Array(c),g=new Array(c),h=new Array(c),i=0;c>i;i++)!function(i){var j=a[i];d.add(j.subscribe(function(a){e||(f[i]=!0,h[i]=a)},function(a){e=!0,b.onError(a),d.dispose()},function(){if(!e){if(!f[i])return b.onCompleted(),void 0;g[i]=!0;for(var a=0;c>a;a++)if(!g[a])return;e=!0,b.onNext(h),b.onCompleted()}}))}(i);return d})},i.forkJoin=function(a,b){var c=this;return new j(function(d){var e,f,g=!1,h=!1,i=!1,j=!1,k=new q,l=new q;return k.setDisposable(c.subscribe(function(a){i=!0,e=a},function(a){l.dispose(),d.onError(a)},function(){if(g=!0,h)if(i)if(j){var a;try{a=b(e,f)}catch(c){return d.onError(c),void 0}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),l.setDisposable(a.subscribe(function(a){j=!0,f=a},function(a){k.dispose(),d.onError(a)},function(){if(h=!0,g)if(i)if(j){var a;try{a=b(e,f)}catch(c){return d.onError(c),void 0}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),new o(k,l)})},i.manySelect=function(a,b){b||(b=u);var c=this;return l(function(){var d;return c.select(function(a){var b=new C(a);return d&&d.onNext(a),d=b,b}).doAction(e,function(a){d&&d.onError(a)},function(){d&&d.onCompleted()}).observeOn(b).select(function(b,c,d){return a(b,c,d)})})};var C=function(a){function b(a){var b=this,c=new o;return c.add(v.schedule(function(){a.onNext(b.head),c.add(b.tail.mergeObservable().subscribe(a))})),c}function c(c){a.call(this,b),this.head=c,this.tail=new x}return z(c,a),A(c.prototype,y,{onCompleted:function(){this.onNext(h.empty())},onError:function(a){this.onNext(h.throwException(a))},onNext:function(a){this.tail.onNext(a),this.tail.onCompleted()}}),c}(h);return c});
1
+ (function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n,r){function o(){}function i(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:E.call(t)}function s(t,e){return new y(function(){return new m(function(){return t()?{done:!1,value:e}:{done:!0,value:r}})})}var u=n.Observable,c=u.prototype,a=n.AnonymousObservable,l=u.concat,f=u.defer,h=u.empty,p=n.Disposable.empty,d=n.CompositeDisposable,b=n.SerialDisposable,v=n.SingleAssignmentDisposable,m=n.internals.Enumerator,y=n.internals.Enumerable,w=y.forEach,g=n.Scheduler.immediate,x=n.Scheduler.currentThread,E=Array.prototype.slice,C=n.AsyncSubject,D=n.Observer,S=n.internals.inherits,A=n.internals.addProperties,N="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";t.Set&&"function"==typeof(new t.Set)["@@iterator"]&&(N="@@iterator"),c.letBind=c.let=function(t){return t(this)},u["if"]=u.ifThen=function(t,e,n){return f(function(){if(n||(n=h()),n.now){var r=n;n=h(r)}return t()?e:n})},u["for"]=u.forIn=function(t,e){return w(t,e).concat()};var _=u["while"]=u.whileDo=function(t,e){return s(t,e).concat()};c.doWhile=function(t){return l([this,_(t,this)])},u["case"]=u.switchCase=function(t,e,n){return f(function(){if(n||(n=h()),n.now){var o=n;n=h(o)}var i=e[t()];return i!==r?i:n})},c.expand=function(t,e){e||(e=g);var n=this;return new a(function(o){var i=[],s=new b,u=new d(s),c=0,a=!1,l=function(){var n=!1;i.length>0&&(n=!a,a=!0),n&&s.setDisposable(e.scheduleRecursive(function(e){var n;if(!(i.length>0))return a=!1,r;n=i.shift();var s=new v;u.add(s),s.setDisposable(n.subscribe(function(e){o.onNext(e);var n=null;try{n=t(e)}catch(r){o.onError(r)}i.push(n),c++,l()},o.onError.bind(o),function(){u.remove(s),c--,0===c&&o.onCompleted()})),e()}))};return i.push(n),c++,l(),u})},u.forkJoin=function(){var t=i(arguments,0);return new a(function(e){var n=t.length;if(0===n)return e.onCompleted(),p;for(var o=new d,i=!1,s=Array(n),u=Array(n),c=Array(n),a=0;n>a;a++)(function(a){var l=t[a];o.add(l.subscribe(function(t){i||(s[a]=!0,c[a]=t)},function(t){i=!0,e.onError(t),o.dispose()},function(){if(!i){if(!s[a])return e.onCompleted(),r;u[a]=!0;for(var t=0;n>t;t++)if(!u[t])return;i=!0,e.onNext(c),e.onCompleted()}}))})(a);return o})},c.forkJoin=function(t,e){var n=this;return new a(function(o){var i,s,u=!1,c=!1,a=!1,l=!1,f=new v,h=new v;return f.setDisposable(n.subscribe(function(t){a=!0,i=t},function(t){h.dispose(),o.onError(t)},function(){if(u=!0,c)if(a)if(l){var t;try{t=e(i,s)}catch(n){return o.onError(n),r}o.onNext(t),o.onCompleted()}else o.onCompleted();else o.onCompleted()})),h.setDisposable(t.subscribe(function(t){l=!0,s=t},function(t){f.dispose(),o.onError(t)},function(){if(c=!0,u)if(a)if(l){var t;try{t=e(i,s)}catch(n){return o.onError(n),r}o.onNext(t),o.onCompleted()}else o.onCompleted();else o.onCompleted()})),new d(f,h)})},c.manySelect=function(t,e){e||(e=g);var n=this;return f(function(){var r;return n.select(function(t){var e=new O(t);return r&&r.onNext(t),r=e,e}).doAction(o,function(t){r&&r.onError(t)},function(){r&&r.onCompleted()}).observeOn(e).select(function(e,n,r){return t(e,n,r)})})};var O=function(t){function e(t){var e=this,n=new d;return n.add(x.schedule(function(){t.onNext(e.head),n.add(e.tail.mergeObservable().subscribe(t))})),n}function n(n){t.call(this,e),this.head=n,this.tail=new C}return S(n,t),A(n.prototype,D,{onCompleted:function(){this.onNext(u.empty())},onError:function(t){this.onNext(u.throwException(t))},onNext:function(t){this.tail.onNext(t),this.tail.onCompleted()}}),n}(u);return n});
@@ -1 +1 @@
1
- (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(){}function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:s.call(a)}function f(a){this.patterns=a}function g(a,b){this.expression=a,this.selector=b}function h(a,b,c){var d=a.get(b);if(!d){var e=new u(b,c);return a.set(b,e),e}return d}function i(a,b,c){var d,e;for(this.joinObserverArray=a,this.onNext=b,this.onCompleted=c,this.joinObservers=new t,d=0;d<this.joinObserverArray.length;d++)e=this.joinObserverArray[d],this.joinObservers.set(e,e)}var j=c.Observable,k=j.prototype,l=c.AnonymousObservable,m=j.throwException,n=c.Observer.create,o=c.SingleAssignmentDisposable,p=c.CompositeDisposable,q=c.internals.AbstractObserver,r=(c.internals.isEqual,c.internals.inherits),s=Array.prototype.slice,t=function(){function a(){this.keys=[],this.values=[]}return a.prototype["delete"]=function(a){var b=this.keys.indexOf(a);return-1!==b&&(this.keys.splice(b,1),this.values.splice(b,1)),-1!==b},a.prototype.get=function(a,b){var c=this.keys.indexOf(a);return-1!==c?this.values[c]:b},a.prototype.set=function(a,b){var c=this.keys.indexOf(a);-1!==c&&(this.values[c]=b),this.values[this.keys.push(a)-1]=b},a.prototype.size=function(){return this.keys.length},a.prototype.has=function(a){return-1!==this.keys.indexOf(a)},a.prototype.getKeys=function(){return this.keys.slice(0)},a.prototype.getValues=function(){return this.values.slice(0)},a}();f.prototype.and=function(a){var b=this.patterns.slice(0);return b.push(a),new f(b)},f.prototype.then=function(a){return new g(this,a)},g.prototype.activate=function(a,b,c){for(var d=this,e=[],f=0,g=this.expression.patterns.length;g>f;f++)e.push(h(a,this.expression.patterns[f],b.onError.bind(b)));var j=new i(e,function(){var a;try{a=d.selector.apply(d,arguments)}catch(c){return b.onError(c),void 0}b.onNext(a)},function(){for(var a=0,b=e.length;b>a;a++)e[a].removeActivePlan(j);c(j)});for(f=0,g=e.length;g>f;f++)e[f].addActivePlan(j);return j},i.prototype.dequeue=function(){for(var a=this.joinObservers.getValues(),b=0,c=a.length;c>b;b++)a[b].queue.shift()},i.prototype.match=function(){var a,b,c,d,e,f=!0;for(b=0,c=this.joinObserverArray.length;c>b;b++)if(0===this.joinObserverArray[b].queue.length){f=!1;break}if(f){for(a=[],d=!1,b=0,c=this.joinObserverArray.length;c>b;b++)a.push(this.joinObserverArray[b].queue[0]),"C"===this.joinObserverArray[b].queue[0].kind&&(d=!0);if(d)this.onCompleted();else{for(this.dequeue(),e=[],b=0;b<a.length;b++)e.push(a[b].value);this.onNext.apply(this,e)}}};var u=function(a){function b(b,c){a.call(this),this.source=b,this.onError=c,this.queue=[],this.activePlans=[],this.subscription=new o,this.isDisposed=!1}r(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return this.onError(a.exception),void 0;this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=d,c.completed=d,c.addActivePlan=function(a){this.activePlans.push(a)},c.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},c.removeActivePlan=function(a){var b=this.activePlans.indexOf(a);this.activePlans.splice(b,1),0===this.activePlans.length&&this.dispose()},c.dispose=function(){a.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},b}(q);return k.and=function(a){return new f([this,a])},k.then=function(a){return new f([this]).then(a)},j.when=function(){var a=e(arguments,0);return new l(function(b){var c,d,e,f,g,h,i=[],j=new t;h=n(b.onNext.bind(b),function(a){for(var c=j.getValues(),d=0,e=c.length;e>d;d++)c[d].onError(a);b.onError(a)},b.onCompleted.bind(b));try{for(d=0,e=a.length;e>d;d++)i.push(a[d].activate(j,h,function(a){var b=i.indexOf(a);i.splice(b,1),0===i.length&&h.onCompleted()}))}catch(k){m(k).subscribe(b)}for(c=new p,g=j.getValues(),d=0,e=g.length;e>d;d++)f=g[d],f.subscribe(),c.add(f);return c})},c});
1
+ (function(t){var e={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},n=e[typeof window]&&window||this,r=e[typeof exports]&&exports&&!exports.nodeType&&exports,o=e[typeof module]&&module&&!module.nodeType&&module,i=(o&&o.exports===r&&r,e[typeof global]&&global);!i||i.global!==i&&i.window!==i||(n=i),"function"==typeof define&&define.amd?define(["rx","exports"],function(e,r){return n.Rx=t(n,r,e),n.Rx}):"object"==typeof module&&module&&module.exports===r?module.exports=t(n,module.exports,require("./rx")):n.Rx=t(n,{},n.Rx)}).call(this,function(t,e,n){function r(){}function o(t,e){return 1===t.length&&Array.isArray(t[e])?t[e]:y.call(t)}function i(t){this.patterns=t}function s(t,e){this.expression=t,this.selector=e}function u(t,e,n){var r=t.get(e);if(!r){var o=new g(e,n);return t.set(e,o),o}return r}function c(t,e,n){var r,o;for(this.joinObserverArray=t,this.onNext=e,this.onCompleted=n,this.joinObservers=new w,r=0;this.joinObserverArray.length>r;r++)o=this.joinObserverArray[r],this.joinObservers.set(o,o)}var a=n.Observable,l=a.prototype,h=n.AnonymousObservable,f=a.throwException,p=n.Observer.create,d=n.SingleAssignmentDisposable,b=n.CompositeDisposable,v=n.internals.AbstractObserver;n.internals.isEqual;var m=n.internals.inherits,y=Array.prototype.slice,w=function(){function t(){this.keys=[],this.values=[]}return t.prototype["delete"]=function(t){var e=this.keys.indexOf(t);return-1!==e&&(this.keys.splice(e,1),this.values.splice(e,1)),-1!==e},t.prototype.get=function(t,e){var n=this.keys.indexOf(t);return-1!==n?this.values[n]:e},t.prototype.set=function(t,e){var n=this.keys.indexOf(t);-1!==n&&(this.values[n]=e),this.values[this.keys.push(t)-1]=e},t.prototype.size=function(){return this.keys.length},t.prototype.has=function(t){return-1!==this.keys.indexOf(t)},t.prototype.getKeys=function(){return this.keys.slice(0)},t.prototype.getValues=function(){return this.values.slice(0)},t}();i.prototype.and=function(t){var e=this.patterns.slice(0);return e.push(t),new i(e)},i.prototype.then=function(t){return new s(this,t)},s.prototype.activate=function(t,e,n){for(var r=this,o=[],i=0,s=this.expression.patterns.length;s>i;i++)o.push(u(t,this.expression.patterns[i],e.onError.bind(e)));var a=new c(o,function(){var t;try{t=r.selector.apply(r,arguments)}catch(n){return e.onError(n),undefined}e.onNext(t)},function(){for(var t=0,e=o.length;e>t;t++)o[t].removeActivePlan(a);n(a)});for(i=0,s=o.length;s>i;i++)o[i].addActivePlan(a);return a},c.prototype.dequeue=function(){for(var t=this.joinObservers.getValues(),e=0,n=t.length;n>e;e++)t[e].queue.shift()},c.prototype.match=function(){var t,e,n,r,o,i=!0;for(e=0,n=this.joinObserverArray.length;n>e;e++)if(0===this.joinObserverArray[e].queue.length){i=!1;break}if(i){for(t=[],r=!1,e=0,n=this.joinObserverArray.length;n>e;e++)t.push(this.joinObserverArray[e].queue[0]),"C"===this.joinObserverArray[e].queue[0].kind&&(r=!0);if(r)this.onCompleted();else{for(this.dequeue(),o=[],e=0;t.length>e;e++)o.push(t[e].value);this.onNext.apply(this,o)}}};var g=function(t){function e(e,n){t.call(this),this.source=e,this.onError=n,this.queue=[],this.activePlans=[],this.subscription=new d,this.isDisposed=!1}m(e,t);var n=e.prototype;return n.next=function(t){if(!this.isDisposed){if("E"===t.kind)return this.onError(t.exception),undefined;this.queue.push(t);for(var e=this.activePlans.slice(0),n=0,r=e.length;r>n;n++)e[n].match()}},n.error=r,n.completed=r,n.addActivePlan=function(t){this.activePlans.push(t)},n.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},n.removeActivePlan=function(t){var e=this.activePlans.indexOf(t);this.activePlans.splice(e,1),0===this.activePlans.length&&this.dispose()},n.dispose=function(){t.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},e}(v);return l.and=function(t){return new i([this,t])},l.then=function(t){return new i([this]).then(t)},a.when=function(){var t=o(arguments,0);return new h(function(e){var n,r,o,i,s,u,c=[],a=new w;u=p(e.onNext.bind(e),function(t){for(var n=a.getValues(),r=0,o=n.length;o>r;r++)n[r].onError(t);e.onError(t)},e.onCompleted.bind(e));try{for(r=0,o=t.length;o>r;r++)c.push(t[r].activate(a,u,function(t){var e=c.indexOf(t);c.splice(e,1),0===c.length&&u.onCompleted()}))}catch(l){f(l).subscribe(e)}for(n=new b,s=a.getValues(),r=0,o=s.length;o>r;r++)i=s[r],i.subscribe(),n.add(i);return n})},n});
@@ -23,26 +23,33 @@
23
23
 
24
24
  var Rx = { internals: {}, config: {} };
25
25
 
26
- // Defaults
27
- function noop() { }
28
- function identity(x) { return x; }
29
- var defaultNow = Date.now;
30
- function defaultComparer(x, y) { return isEqual(x, y); }
31
- function defaultSubComparer(x, y) { return x - y; }
32
- function defaultKeySerializer(x) { return x.toString(); }
33
- function defaultError(err) { throw err; }
34
- function isPromise(p) { return typeof p.then === 'function'; }
35
-
36
- // Errors
37
- var sequenceContainsNoElements = 'Sequence contains no elements.';
38
- var argumentOutOfRange = 'Argument out of range';
39
- var objectDisposed = 'Object has been disposed';
40
- function checkDisposed() {
41
- if (this.isDisposed) {
42
- throw new Error(objectDisposed);
43
- }
44
- }
45
-
26
+ // Defaults
27
+ function noop() { }
28
+ function identity(x) { return x; }
29
+ var defaultNow = Date.now;
30
+ function defaultComparer(x, y) { return isEqual(x, y); }
31
+ function defaultSubComparer(x, y) { return x - y; }
32
+ function defaultKeySerializer(x) { return x.toString(); }
33
+ function defaultError(err) { throw err; }
34
+ function isPromise(p) { return typeof p.then === 'function' && typeof p.subscribe === 'undefined'; }
35
+
36
+ // Errors
37
+ var sequenceContainsNoElements = 'Sequence contains no elements.';
38
+ var argumentOutOfRange = 'Argument out of range';
39
+ var objectDisposed = 'Object has been disposed';
40
+ function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
41
+
42
+ // Shim in iterator support
43
+ var $iterator$ = (typeof Symbol === 'object' && Symbol.iterator) ||
44
+ '_es6shim_iterator_';
45
+ // Firefox ships a partial implementation using the name @@iterator.
46
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14
47
+ // So use that name if we detect it.
48
+ if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
49
+ $iterator$ = '@@iterator';
50
+ }
51
+ var doneEnumerator = { done: true, value: undefined };
52
+
46
53
  /** `Object#toString` result shortcuts */
47
54
  var argsClass = '[object Arguments]',
48
55
  arrayClass = '[object Array]',
@@ -1512,155 +1519,143 @@
1512
1519
  };
1513
1520
  }());
1514
1521
 
1515
- /**
1516
- * @constructor
1517
- * @private
1518
- */
1519
- var Enumerator = Rx.internals.Enumerator = function (moveNext, getCurrent) {
1520
- this.moveNext = moveNext;
1521
- this.getCurrent = getCurrent;
1522
- };
1522
+ var Enumerator = Rx.internals.Enumerator = function (next) {
1523
+ this._next = next;
1524
+ };
1523
1525
 
1524
- /**
1525
- * @static
1526
- * @memberOf Enumerator
1527
- * @private
1528
- */
1529
- var enumeratorCreate = Enumerator.create = function (moveNext, getCurrent) {
1530
- var done = false;
1531
- return new Enumerator(function () {
1532
- if (done) {
1533
- return false;
1534
- }
1535
- var result = moveNext();
1536
- if (!result) {
1537
- done = true;
1538
- }
1539
- return result;
1540
- }, function () { return getCurrent(); });
1541
- };
1542
-
1543
- var Enumerable = Rx.internals.Enumerable = function (getEnumerator) {
1544
- this.getEnumerator = getEnumerator;
1545
- };
1526
+ Enumerator.prototype.next = function () {
1527
+ return this._next();
1528
+ };
1546
1529
 
1547
- Enumerable.prototype.concat = function () {
1548
- var sources = this;
1549
- return new AnonymousObservable(function (observer) {
1550
- var e = sources.getEnumerator(), isDisposed, subscription = new SerialDisposable();
1551
- var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1552
- var current, hasNext;
1553
- if (isDisposed) { return; }
1530
+ Enumerator.prototype[$iterator$] = function () { return this; }
1554
1531
 
1555
- try {
1556
- hasNext = e.moveNext();
1557
- if (hasNext) {
1558
- current = e.getCurrent();
1559
- }
1560
- } catch (ex) {
1561
- observer.onError(ex);
1562
- return;
1563
- }
1532
+ var Enumerable = Rx.internals.Enumerable = function (iterator) {
1533
+ this._iterator = iterator;
1534
+ };
1564
1535
 
1565
- if (!hasNext) {
1566
- observer.onCompleted();
1567
- return;
1568
- }
1536
+ Enumerable.prototype[$iterator$] = function () {
1537
+ return this._iterator();
1538
+ };
1569
1539
 
1570
- var d = new SingleAssignmentDisposable();
1571
- subscription.setDisposable(d);
1572
- d.setDisposable(current.subscribe(
1573
- observer.onNext.bind(observer),
1574
- observer.onError.bind(observer),
1575
- function () { self(); })
1576
- );
1577
- });
1578
- return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1579
- isDisposed = true;
1580
- }));
1581
- });
1582
- };
1540
+ Enumerable.prototype.concat = function () {
1541
+ var sources = this;
1542
+ return new AnonymousObservable(function (observer) {
1543
+ var e;
1544
+ try {
1545
+ e = sources[$iterator$]();
1546
+ } catch(err) {
1547
+ observer.onError();
1548
+ return;
1549
+ }
1583
1550
 
1584
- Enumerable.prototype.catchException = function () {
1585
- var sources = this;
1586
- return new AnonymousObservable(function (observer) {
1587
- var e = sources.getEnumerator(), isDisposed, lastException;
1588
- var subscription = new SerialDisposable();
1589
- var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1590
- var current, hasNext;
1591
- if (isDisposed) { return; }
1551
+ var isDisposed,
1552
+ subscription = new SerialDisposable();
1553
+ var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1554
+ var currentItem;
1555
+ if (isDisposed) { return; }
1592
1556
 
1593
- try {
1594
- hasNext = e.moveNext();
1595
- if (hasNext) {
1596
- current = e.getCurrent();
1597
- }
1598
- } catch (ex) {
1599
- observer.onError(ex);
1600
- return;
1601
- }
1557
+ try {
1558
+ currentItem = e.next();
1559
+ } catch (ex) {
1560
+ observer.onError(ex);
1561
+ return;
1562
+ }
1602
1563
 
1603
- if (!hasNext) {
1604
- if (lastException) {
1605
- observer.onError(lastException);
1606
- } else {
1607
- observer.onCompleted();
1608
- }
1609
- return;
1610
- }
1564
+ if (currentItem.done) {
1565
+ observer.onCompleted();
1566
+ return;
1567
+ }
1611
1568
 
1612
- var d = new SingleAssignmentDisposable();
1613
- subscription.setDisposable(d);
1614
- d.setDisposable(current.subscribe(
1615
- observer.onNext.bind(observer),
1616
- function (exn) {
1617
- lastException = exn;
1618
- self();
1619
- },
1620
- observer.onCompleted.bind(observer)));
1621
- });
1622
- return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1623
- isDisposed = true;
1624
- }));
1569
+ var d = new SingleAssignmentDisposable();
1570
+ subscription.setDisposable(d);
1571
+ d.setDisposable(currentItem.value.subscribe(
1572
+ observer.onNext.bind(observer),
1573
+ observer.onError.bind(observer),
1574
+ function () { self(); })
1575
+ );
1625
1576
  });
1626
- };
1627
1577
 
1578
+ return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1579
+ isDisposed = true;
1580
+ }));
1581
+ });
1582
+ };
1628
1583
 
1629
- var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
1630
- if (arguments.length === 1) {
1631
- repeatCount = -1;
1584
+ Enumerable.prototype.catchException = function () {
1585
+ var sources = this;
1586
+ return new AnonymousObservable(function (observer) {
1587
+ var e;
1588
+ try {
1589
+ e = sources[$iterator$]();
1590
+ } catch(err) {
1591
+ observer.onError();
1592
+ return;
1593
+ }
1594
+
1595
+ var isDisposed,
1596
+ lastException,
1597
+ subscription = new SerialDisposable();
1598
+ var cancelable = immediateScheduler.scheduleRecursive(function (self) {
1599
+ if (isDisposed) { return; }
1600
+
1601
+ var currentItem;
1602
+ try {
1603
+ currentItem = e.next();
1604
+ } catch (ex) {
1605
+ observer.onError(ex);
1606
+ return;
1632
1607
  }
1633
- return new Enumerable(function () {
1634
- var current, left = repeatCount;
1635
- return enumeratorCreate(function () {
1636
- if (left === 0) {
1637
- return false;
1638
- }
1639
- if (left > 0) {
1640
- left--;
1641
- }
1642
- current = value;
1643
- return true;
1644
- }, function () { return current; });
1645
- });
1646
- };
1647
1608
 
1648
- var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
1649
- selector || (selector = identity);
1650
- return new Enumerable(function () {
1651
- var current, index = -1;
1652
- return enumeratorCreate(
1653
- function () {
1654
- if (++index < source.length) {
1655
- current = selector.call(thisArg, source[index], index, source);
1656
- return true;
1657
- }
1658
- return false;
1659
- },
1660
- function () { return current; }
1661
- );
1609
+ if (currentItem.done) {
1610
+ if (lastException) {
1611
+ observer.onError(lastException);
1612
+ } else {
1613
+ observer.onCompleted();
1614
+ }
1615
+ return;
1616
+ }
1617
+
1618
+ var d = new SingleAssignmentDisposable();
1619
+ subscription.setDisposable(d);
1620
+ d.setDisposable(currentItem.value.subscribe(
1621
+ observer.onNext.bind(observer),
1622
+ function (exn) {
1623
+ lastException = exn;
1624
+ self();
1625
+ },
1626
+ observer.onCompleted.bind(observer)));
1627
+ });
1628
+ return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
1629
+ isDisposed = true;
1630
+ }));
1631
+ });
1632
+ };
1633
+
1634
+
1635
+ var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
1636
+ if (repeatCount == null) { repeatCount = -1; }
1637
+ return new Enumerable(function () {
1638
+ var left = repeatCount;
1639
+ return new Enumerator(function () {
1640
+ if (left === 0) { return doneEnumerator; }
1641
+ if (left > 0) { left--; }
1642
+ return { done: false, value: value };
1643
+ });
1644
+ });
1645
+ };
1646
+
1647
+ var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
1648
+ selector || (selector = identity);
1649
+ return new Enumerable(function () {
1650
+ var index = -1;
1651
+ return new Enumerator(
1652
+ function () {
1653
+ return ++index < source.length ?
1654
+ { done: false, value: selector.call(thisArg, source[index], index, source) } :
1655
+ doneEnumerator;
1662
1656
  });
1663
- };
1657
+ });
1658
+ };
1664
1659
 
1665
1660
  /**
1666
1661
  * Supports push-style iteration over an observable sequence.
@@ -2252,37 +2247,44 @@
2252
2247
  });
2253
2248
  };
2254
2249
 
2255
- /**
2256
- * Converts a generator function to an observable sequence, using an optional scheduler to enumerate the generator.
2257
- *
2258
- * @example
2259
- * var res = Rx.Observable.fromGenerator(function* () { yield 42; });
2260
- * var res = Rx.Observable.fromArray(function* () { yield 42; }, Rx.Scheduler.timeout);
2261
- * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
2262
- * @returns {Observable} The observable sequence whose elements are pulled from the given generator sequence.
2263
- */
2264
- observableProto.fromGenerator = function (genFn, scheduler) {
2265
- scheduler || (scheduler = currentThreadScheduler);
2266
- return new AnonymousObservable(function (observer) {
2267
- var gen;
2268
- try {
2269
- gen = genFn();
2270
- } catch (e) {
2271
- observer.onError(e);
2272
- return;
2273
- }
2250
+ /**
2251
+ * Converts an iterable into an Observable sequence
2252
+ *
2253
+ * @example
2254
+ * var res = Rx.Observable.fromIterable(new Map());
2255
+ * var res = Rx.Observable.fromIterable(new Set(), Rx.Scheduler.timeout);
2256
+ * @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
2257
+ * @returns {Observable} The observable sequence whose elements are pulled from the given generator sequence.
2258
+ */
2259
+ Observable.fromIterable = function (iterable, scheduler) {
2260
+ scheduler || (scheduler = currentThreadScheduler);
2261
+ return new AnonymousObservable(function (observer) {
2262
+ var iterator;
2263
+ try {
2264
+ iterator = iterable[$iterator$]();
2265
+ } catch (e) {
2266
+ observer.onError(e);
2267
+ return;
2268
+ }
2274
2269
 
2275
- return scheduler.scheduleRecursive(function (self) {
2276
- var next = gen.next();
2277
- if (next.done) {
2278
- observer.onCompleted();
2279
- } else {
2280
- observer.onNext(next.value);
2281
- self();
2282
- }
2283
- });
2284
- });
2285
- };
2270
+ return scheduler.scheduleRecursive(function (self) {
2271
+ var next;
2272
+ try {
2273
+ next = iterator.next();
2274
+ } catch (err) {
2275
+ observer.onError(err);
2276
+ return;
2277
+ }
2278
+
2279
+ if (next.done) {
2280
+ observer.onCompleted();
2281
+ } else {
2282
+ observer.onNext(next.value);
2283
+ self();
2284
+ }
2285
+ });
2286
+ });
2287
+ };
2286
2288
 
2287
2289
  /**
2288
2290
  * Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.