rxjs-rails 2.2.18 → 2.2.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -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(){return new r(function(){return a()?{done:!1,value:b}:{done:!0,value:d}})})}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,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,B="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";a.Set&&"function"==typeof(new a.Set)["@@iterator"]&&(B="@@iterator");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 C=h["while"]=h.whileDo=function(a,b){return g(a,b).concat()};i.doWhile=function(a){return k([this,C(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 void(i=!1);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 void b.onCompleted();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 void d.onError(c)}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 void d.onError(c)}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 D(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 D=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(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:v.call(a)}function f(a,b){return new r(function(){return new q(function(){return a()?{done:!1,value:b}:{done:!0,value:d}})})}var g=c.Observable,h=g.prototype,i=c.AnonymousObservable,j=g.concat,k=g.defer,l=g.empty,m=c.Disposable.empty,n=c.CompositeDisposable,o=c.SerialDisposable,p=c.SingleAssignmentDisposable,q=c.internals.Enumerator,r=c.internals.Enumerable,s=r.forEach,t=c.Scheduler.immediate,u=c.Scheduler.currentThread,v=Array.prototype.slice,w=c.AsyncSubject,x=c.Observer,y=c.internals.inherits,z=c.internals.addProperties,A=c.helpers.noop,B="object"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";a.Set&&"function"==typeof(new a.Set)["@@iterator"]&&(B="@@iterator");h.letBind=h.let=function(a){return a(this)},g["if"]=g.ifThen=function(a,b,c){return k(function(){if(c||(c=l()),c.now){var d=c;c=l(d)}return a()?b:c})},g["for"]=g.forIn=function(a,b){return s(a,b).concat()};var C=g["while"]=g.whileDo=function(a,b){return f(a,b).concat()};h.doWhile=function(a){return j([this,C(a,this)])},g["case"]=g.switchCase=function(a,b,c){return k(function(){if(c||(c=l()),c.now){var e=c;c=l(e)}var f=b[a()];return f!==d?f:c})},h.expand=function(a,b){b||(b=t);var c=this;return new i(function(d){var e=[],f=new o,g=new n(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 void(i=!1);c=e.shift();var f=new p;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})},g.forkJoin=function(){var a=e(arguments,0);return new i(function(b){var c=a.length;if(0===c)return b.onCompleted(),m;for(var d=new n,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 void b.onCompleted();g[i]=!0;for(var a=0;c>a;a++)if(!g[a])return;e=!0,b.onNext(h),b.onCompleted()}}))}(i);return d})},h.forkJoin=function(a,b){var c=this;return new i(function(d){var e,f,g=!1,h=!1,i=!1,j=!1,k=new p,l=new p;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 void d.onError(c)}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 void d.onError(c)}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),new n(k,l)})},h.manySelect=function(a,b){b||(b=t);var c=this;return k(function(){var d;return c.select(function(a){var b=new D(a);return d&&d.onNext(a),d=b,b}).doAction(A,function(a){d&&d.onError(a)},function(){d&&d.onCompleted()}).observeOn(b).select(function(b,c,d){return a(b,c,d)})})};var D=function(a){function b(a){var b=this,c=new n;return c.add(u.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 w}return y(c,a),z(c.prototype,x,{onCompleted:function(){this.onNext(g.empty())},onError:function(a){this.onNext(g.throwException(a))},onNext:function(a){this.tail.onNext(a),this.tail.onCompleted()}}),c}(g);return c});
@@ -42,15 +42,12 @@
42
42
  SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
43
43
  CompositeDisposable = Rx.CompositeDisposable,
44
44
  AbstractObserver = Rx.internals.AbstractObserver,
45
- isEqual = Rx.internals.isEqual;
46
-
47
- // Defaults
48
- function defaultComparer(x, y) { return isEqual(x, y); }
49
- function noop() { }
45
+ noop = Rx.helpers.noop,
46
+ defaultComparer = Rx.internals.isEqual,
47
+ inherits = Rx.internals.inherits,
48
+ slice = Array.prototype.slice;
50
49
 
51
50
  // Utilities
52
- var inherits = Rx.internals.inherits;
53
- var slice = Array.prototype.slice;
54
51
  function argsOrArray(args, idx) {
55
52
  return args.length === 1 && Array.isArray(args[idx]) ?
56
53
  args[idx] :
@@ -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 void b.onError(c)}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 void this.onError(a.exception);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(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(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:s.call(a)}function e(a){this.patterns=a}function f(a,b){this.expression=a,this.selector=b}function g(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 h(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 i=c.Observable,j=i.prototype,k=c.AnonymousObservable,l=i.throwException,m=c.Observer.create,n=c.SingleAssignmentDisposable,o=c.CompositeDisposable,p=c.internals.AbstractObserver,q=c.helpers.noop,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}();e.prototype.and=function(a){var b=this.patterns.slice(0);return b.push(a),new e(b)},e.prototype.then=function(a){return new f(this,a)},f.prototype.activate=function(a,b,c){for(var d=this,e=[],f=0,i=this.expression.patterns.length;i>f;f++)e.push(g(a,this.expression.patterns[f],b.onError.bind(b)));var j=new h(e,function(){var a;try{a=d.selector.apply(d,arguments)}catch(c){return void b.onError(c)}b.onNext(a)},function(){for(var a=0,b=e.length;b>a;a++)e[a].removeActivePlan(j);c(j)});for(f=0,i=e.length;i>f;f++)e[f].addActivePlan(j);return j},h.prototype.dequeue=function(){for(var a=this.joinObservers.getValues(),b=0,c=a.length;c>b;b++)a[b].queue.shift()},h.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 n,this.isDisposed=!1}r(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return void this.onError(a.exception);this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=q,c.completed=q,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}(p);return j.and=function(a){return new e([this,a])},j.then=function(a){return new e([this]).then(a)},i.when=function(){var a=d(arguments,0);return new k(function(b){var c,d,e,f,g,h,i=[],j=new t;h=m(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){l(k).subscribe(b)}for(c=new o,g=j.getValues(),d=0,e=g.length;e>d;d++)f=g[d],f.subscribe(),c.add(f);return c})},c});
@@ -25,18 +25,21 @@
25
25
  internals: {},
26
26
  config: {
27
27
  Promise: root.Promise // Detect if promise exists
28
- }
28
+ },
29
+ helpers: { }
29
30
  };
30
31
 
31
32
  // Defaults
32
- function noop() { }
33
- function identity(x) { return x; }
34
- var defaultNow = Date.now;
35
- function defaultComparer(x, y) { return isEqual(x, y); }
36
- function defaultSubComparer(x, y) { return x - y; }
37
- function defaultKeySerializer(x) { return x.toString(); }
38
- function defaultError(err) { throw err; }
39
- function isPromise(p) { return typeof p.then === 'function' && p.then !== Rx.Observable.prototype.then; }
33
+ var noop = Rx.helpers.noop = function () { },
34
+ identity = Rx.helpers.identity = function (x) { return x; },
35
+ defaultNow = Rx.helpers.defaultNow = Date.now,
36
+ defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
37
+ defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
38
+ defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
39
+ defaultError = Rx.helpers.defaultError = function (err) { throw err; },
40
+ isPromise = Rx.helpers.isPromise = function (p) { return typeof p.then === 'function' && p.then !== Rx.Observable.prototype.then; },
41
+ asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
42
+ not = Rx.helpers.not = function (a) { return !a; };
40
43
 
41
44
  // Errors
42
45
  var sequenceContainsNoElements = 'Sequence contains no elements.';
@@ -1571,9 +1574,13 @@
1571
1574
  return;
1572
1575
  }
1573
1576
 
1577
+ // Check if promise
1578
+ var currentValue = currentItem.value;
1579
+ isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
1580
+
1574
1581
  var d = new SingleAssignmentDisposable();
1575
1582
  subscription.setDisposable(d);
1576
- d.setDisposable(currentItem.value.subscribe(
1583
+ d.setDisposable(currentValue.subscribe(
1577
1584
  observer.onNext.bind(observer),
1578
1585
  observer.onError.bind(observer),
1579
1586
  function () { self(); })
@@ -1620,9 +1627,13 @@
1620
1627
  return;
1621
1628
  }
1622
1629
 
1630
+ // Check if promise
1631
+ var currentValue = currentItem.value;
1632
+ isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
1633
+
1623
1634
  var d = new SingleAssignmentDisposable();
1624
1635
  subscription.setDisposable(d);
1625
- d.setDisposable(currentItem.value.subscribe(
1636
+ d.setDisposable(currentValue.subscribe(
1626
1637
  observer.onNext.bind(observer),
1627
1638
  function (exn) {
1628
1639
  lastException = exn;
@@ -2141,6 +2152,12 @@
2141
2152
  function (reason) {
2142
2153
  observer.onError(reason);
2143
2154
  });
2155
+
2156
+ return function () {
2157
+ if (promise && promise.abort) {
2158
+ promise.abort();
2159
+ }
2160
+ }
2144
2161
  });
2145
2162
  };
2146
2163
  /*
@@ -2206,6 +2223,9 @@
2206
2223
  } catch (e) {
2207
2224
  return observableThrow(e).subscribe(observer);
2208
2225
  }
2226
+
2227
+ // Check if promise
2228
+ isPromise(result) && (result = observableFromPromise(result));
2209
2229
  return result.subscribe(observer);
2210
2230
  });
2211
2231
  };