rxjs-rails 2.5.2 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.js +367 -284
- data/vendor/assets/javascripts/rx.aggregates.map +1 -1
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.all.compat.js +2405 -2438
- data/vendor/assets/javascripts/rx.all.compat.map +1 -1
- data/vendor/assets/javascripts/rx.all.compat.min.js +4 -4
- data/vendor/assets/javascripts/rx.all.js +2380 -2395
- data/vendor/assets/javascripts/rx.all.map +1 -1
- data/vendor/assets/javascripts/rx.all.min.js +4 -4
- data/vendor/assets/javascripts/rx.async.compat.js +311 -333
- data/vendor/assets/javascripts/rx.async.compat.map +1 -1
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +280 -327
- data/vendor/assets/javascripts/rx.async.map +1 -1
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.backpressure.js +208 -176
- data/vendor/assets/javascripts/rx.backpressure.map +1 -1
- data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
- data/vendor/assets/javascripts/rx.binding.js +44 -27
- data/vendor/assets/javascripts/rx.binding.map +1 -1
- data/vendor/assets/javascripts/rx.binding.min.js +1 -1
- data/vendor/assets/javascripts/rx.coincidence.js +220 -453
- data/vendor/assets/javascripts/rx.coincidence.map +1 -1
- data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +1366 -1173
- data/vendor/assets/javascripts/rx.compat.map +1 -1
- data/vendor/assets/javascripts/rx.compat.min.js +3 -2
- data/vendor/assets/javascripts/rx.core.binding.js +823 -0
- data/vendor/assets/javascripts/rx.core.binding.map +1 -0
- data/vendor/assets/javascripts/rx.core.binding.min.js +3 -0
- data/vendor/assets/javascripts/rx.core.js +1281 -0
- data/vendor/assets/javascripts/rx.core.map +1 -0
- data/vendor/assets/javascripts/rx.core.min.js +3 -0
- data/vendor/assets/javascripts/rx.core.testing.js +1242 -0
- data/vendor/assets/javascripts/rx.core.testing.map +1 -0
- data/vendor/assets/javascripts/rx.core.testing.min.js +3 -0
- data/vendor/assets/javascripts/rx.experimental.js +85 -123
- data/vendor/assets/javascripts/rx.experimental.map +1 -1
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
- data/vendor/assets/javascripts/rx.joinpatterns.js +48 -37
- data/vendor/assets/javascripts/rx.joinpatterns.map +1 -1
- data/vendor/assets/javascripts/rx.joinpatterns.min.js +1 -1
- data/vendor/assets/javascripts/rx.js +1367 -1174
- data/vendor/assets/javascripts/rx.lite.compat.js +1621 -1403
- data/vendor/assets/javascripts/rx.lite.compat.map +1 -1
- data/vendor/assets/javascripts/rx.lite.compat.min.js +3 -3
- data/vendor/assets/javascripts/rx.lite.extras.compat.js +119 -89
- data/vendor/assets/javascripts/rx.lite.extras.compat.map +1 -1
- data/vendor/assets/javascripts/rx.lite.extras.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.lite.extras.js +119 -89
- data/vendor/assets/javascripts/rx.lite.extras.map +1 -1
- data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
- data/vendor/assets/javascripts/rx.lite.js +1583 -1390
- data/vendor/assets/javascripts/rx.lite.map +1 -1
- data/vendor/assets/javascripts/rx.lite.min.js +3 -3
- data/vendor/assets/javascripts/rx.map +1 -1
- data/vendor/assets/javascripts/rx.min.js +3 -2
- data/vendor/assets/javascripts/rx.sorting.js +23 -27
- data/vendor/assets/javascripts/rx.sorting.map +1 -1
- data/vendor/assets/javascripts/rx.sorting.min.js +1 -1
- data/vendor/assets/javascripts/rx.testing.js +11 -15
- data/vendor/assets/javascripts/rx.testing.map +1 -1
- data/vendor/assets/javascripts/rx.testing.min.js +1 -1
- data/vendor/assets/javascripts/rx.time.js +117 -133
- data/vendor/assets/javascripts/rx.time.map +1 -1
- data/vendor/assets/javascripts/rx.time.min.js +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.js +120 -39
- data/vendor/assets/javascripts/rx.virtualtime.map +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -1
- metadata +12 -3
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rx.core.binding.min.js","sources":["rx.core.binding.js"],"names":["factory","objectTypes","function","object","freeExports","exports","nodeType","freeSelf","self","Object","freeWindow","window","freeModule","module","freeGlobal","global","root","this","define","amd","Rx","require","call","exp","cloneArray","arr","len","length","a","Array","i","tryCatcher","tryCatchTarget","apply","arguments","e","errorObj","tryCatch","fn","isFunction","TypeError","thrower","Observable","observableProto","prototype","AnonymousObservable","Observer","AbstractObserver","internals","disposableCreate","Disposable","create","disposableEmpty","empty","CompositeDisposable","SerialDisposable","currentThreadScheduler","Scheduler","currentThread","helpers","inherits","addProperties","checkDisposed","multicast","subjectOrSubjectSelector","selector","source","observer","connectable","subscribe","connect","ConnectableObservable","publish","Subject","share","refCount","publishLast","AsyncSubject","publishValue","initialValueOrSelector","initialValue","BehaviorSubject","shareValue","replay","bufferSize","windowSize","scheduler","ReplaySubject","shareReplay","ScheduledObserver","__super__","isAcquired","hasFaulted","queue","disposable","next","value","push","onNext","error","onError","completed","onCompleted","ensureActive","isOwner","setDisposable","scheduleRecursiveWithState","parent","work","shift","res","dispose","InnerSubscription","subject","isDisposed","idx","observers","indexOf","splice","isStopped","hasError","hasObservers","os","observable","AnonymousSubject","hasValue","o","exception","getValue","createRemovableDisposable","so","subscription","_trim","now","q","maxSafeInteger","Math","pow","interval","hasSubscription","sourceObservable","asObservable","connectableSubscription","count","shouldConnect"],"mappings":";CAEE,SAAUA,GACV,GAAIC,IACFC,YAAY,EACZC,QAAU,GAIVC,EAAcH,QAAmBI,WAAYA,UAAYA,QAAQC,UAAYD,QAC7EE,EAAWN,QAAmBO,QAASA,KAAKC,QAAUD,KACtDE,EAAaT,QAAmBU,UAAWA,QAAUA,OAAOF,QAAUE,O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tG,KAAKsG,WAAY,CACjB,IAAIc,GAAMpH,KAAKqE,UAAU+C,KACzBpH,MAAKmH,MAAMC,EACX,KAAK,GAAIvG,GAAI,EAAG4F,EAAKlG,EAAWP,KAAKmG,WAAY1F,EAAMgG,EAAG/F,OAAYD,EAAJI,EAASA,IAAK,CAC9E,GAAIqC,GAAWuD,EAAG5F,EAClBqC,GAASmC,cACTnC,EAASoC,eAEXtF,KAAKmG,UAAUzF,OAAS,IAK1BoF,QAAS,WACP9F,KAAKiG,YAAa,EAClBjG,KAAKmG,UAAY,QAId7B,GACP7C,GAEE6B,EAAwBnD,EAAGmD,sBAAyB,SAAUmB,GAGhE,QAASnB,GAAsBL,EAAQ+C,GACrC,GACEkB,GADEQ,GAAkB,EAEpBC,EAAmB1E,EAAO2E,cAE5B5H,MAAKqD,QAAU,WAOb,MANKqE,KACHA,GAAkB,EAClBR,EAAe,GAAI7E,GAAoBsF,EAAiBvE,UAAU4C,GAAUhE,EAAiB,WAC3F0F,GAAkB,MAGfR,GAGTzC,EAAUpE,KAAKL,KAAM,SAAU6G,GAAK,MAAOb,GAAQ5C,UAAUyD,KAgB/D,MAjCAlE,GAASW,EAAuBmB,GAoBhCnB,EAAsB3B,UAAU+B,SAAW,WACzC,GAAImE,GAAyBC,EAAQ,EAAG7E,EAASjD,IACjD,OAAO,IAAI4B,GAAoB,SAAUsB,GACrC,GAAI6E,GAA4B,MAAVD,EACpBZ,EAAejE,EAAOG,UAAUF,EAElC,OADA6E,KAAkBF,EAA0B5E,EAAOI,WAC5C,WACL6D,EAAapB,UACD,MAAVgC,GAAeD,EAAwB/B,cAK1CxC,GACP7B,EAEF,OAAOtB"}
|
@@ -0,0 +1,3 @@
|
|
1
|
+
/* Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.*/
|
2
|
+
(function(a){var b={"function":!0,object:!0},c=b[typeof exports]&&exports&&!exports.nodeType&&exports,d=b[typeof self]&&self.Object&&self,e=b[typeof window]&&window&&window.Object&&window,f=b[typeof module]&&module&&!module.nodeType&&module,g=(f&&f.exports===c&&c,c&&f&&"object"==typeof global&&global&&global.Object&&global),h=h=g||e!==(this&&this.window)&&e||d||this;"function"==typeof define&&define.amd?define(["./rx.core"],function(b,c){return a(h,c,b)}):"object"==typeof module&&module&&module.exports===c?module.exports=a(h,module.exports,require("./rx.core")):h.Rx=a(h,{},h.Rx)}).call(this,function(a,b,c){function d(a){for(var b=a.length,c=new Array(b),d=0;b>d;d++)c[d]=a[d];return c}function e(){try{return h.apply(this,arguments)}catch(a){return w.e=a,w}}function f(a){if(!s(a))throw new TypeError("fn must be a function");return h=a,e}function g(a){throw a}var h,i=c.Observable,j=i.prototype,k=c.AnonymousObservable,l=c.Observer,m=c.internals.AbstractObserver,n=c.Disposable.create,o=c.Disposable.empty,p=c.CompositeDisposable,q=c.SerialDisposable,r=c.Scheduler.currentThread,s=c.helpers.isFunction,t=c.internals.inherits,u=c.internals.addProperties,v=c.Disposable.checkDisposed,w={e:{}};j.multicast=function(a,b){var c=this;return"function"==typeof a?new k(function(d){var e=c.multicast(a());return new p(b(e).subscribe(d),e.connect())},c):new E(c,a)},j.publish=function(a){return a&&s(a)?this.multicast(function(){return new z},a):this.multicast(new z)},j.share=function(){return this.publish().refCount()},j.publishLast=function(a){return a&&s(a)?this.multicast(function(){return new B},a):this.multicast(new B)},j.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new C(b)},a):this.multicast(new C(a))},j.shareValue=function(a){return this.publishValue(a).refCount()},j.replay=function(a,b,c,d){return a&&s(a)?this.multicast(function(){return new D(b,c,d)},a):this.multicast(new D(b,c,d))},j.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var x=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 q}return t(b,a),b.prototype.next=function(a){var b=this;this.queue.push(function(){b.observer.onNext(a)})},b.prototype.error=function(a){var b=this;this.queue.push(function(){b.observer.onError(a)})},b.prototype.completed=function(){var a=this;this.queue.push(function(){a.observer.onCompleted()})},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.scheduleRecursiveWithState(this,function(a,b){var c;if(!(a.queue.length>0))return void(a.isAcquired=!1);c=a.queue.shift();var d=f(c)();return d===w?(a.queue=[],a.hasFaulted=!0,g(d.e)):void b(a)}))},b.prototype.dispose=function(){a.prototype.dispose.call(this),this.disposable.dispose()},b}(m),y=function(a,b){this.subject=a,this.observer=b};y.prototype.dispose=function(){if(!this.subject.isDisposed&&null!==this.observer){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1),this.observer=null}};var z=c.Subject=function(a){function b(a){return v(this),this.isStopped?this.hasError?(a.onError(this.error),o):(a.onCompleted(),o):(this.observers.push(a),new y(this,a))}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.observers=[],this.hasError=!1}return t(c,a),u(c.prototype,l.prototype,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(v(this),!this.isStopped){this.isStopped=!0;for(var a=0,b=d(this.observers),c=b.length;c>a;a++)b[a].onCompleted();this.observers.length=0}},onError:function(a){if(v(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;for(var b=0,c=d(this.observers),e=c.length;e>b;b++)c[b].onError(a);this.observers.length=0}},onNext:function(a){if(v(this),!this.isStopped)for(var b=0,c=d(this.observers),e=c.length;e>b;b++)c[b].onNext(a)},dispose:function(){this.isDisposed=!0,this.observers=null}}),c.create=function(a,b){return new A(a,b)},c}(i),A=c.AnonymousSubject=function(a){function b(a){return this.observable.subscribe(a)}function c(c,d){this.observer=c,this.observable=d,a.call(this,b)}return t(c,a),u(c.prototype,l.prototype,{onCompleted:function(){this.observer.onCompleted()},onError:function(a){this.observer.onError(a)},onNext:function(a){this.observer.onNext(a)}}),c}(i),B=c.AsyncSubject=function(a){function b(a){return v(this),this.isStopped?(this.hasError?a.onError(this.error):this.hasValue?(a.onNext(this.value),a.onCompleted()):a.onCompleted(),o):(this.observers.push(a),new y(this,a))}function c(){a.call(this,b),this.isDisposed=!1,this.isStopped=!1,this.hasValue=!1,this.observers=[],this.hasError=!1}return t(c,a),u(c.prototype,l,{hasObservers:function(){return v(this),this.observers.length>0},onCompleted:function(){var a,b;if(v(this),!this.isStopped){this.isStopped=!0;var c=d(this.observers),b=c.length;if(this.hasValue)for(a=0;b>a;a++){var e=c[a];e.onNext(this.value),e.onCompleted()}else for(a=0;b>a;a++)c[a].onCompleted();this.observers.length=0}},onError:function(a){if(v(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var b=0,c=d(this.observers),e=c.length;e>b;b++)c[b].onError(a);this.observers.length=0}},onNext:function(a){v(this),this.isStopped||(this.value=a,this.hasValue=!0)},dispose:function(){this.isDisposed=!0,this.observers=null,this.exception=null,this.value=null}}),c}(i),C=c.BehaviorSubject=function(a){function b(a){return v(this),this.isStopped?(this.hasError?a.onError(this.error):a.onCompleted(),o):(this.observers.push(a),a.onNext(this.value),new y(this,a))}function c(c){a.call(this,b),this.value=c,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.hasError=!1}return t(c,a),u(c.prototype,l,{getValue:function(){if(v(this),this.hasError)throw this.error;return this.value},hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(v(this),!this.isStopped){this.isStopped=!0;for(var a=0,b=d(this.observers),c=b.length;c>a;a++)b[a].onCompleted();this.observers.length=0}},onError:function(a){if(v(this),!this.isStopped){this.isStopped=!0,this.hasError=!0,this.error=a;for(var b=0,c=d(this.observers),e=c.length;e>b;b++)c[b].onError(a);this.observers.length=0}},onNext:function(a){if(v(this),!this.isStopped){this.value=a;for(var b=0,c=d(this.observers),e=c.length;e>b;b++)c[b].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),c}(i),D=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(a){var c=new x(this.scheduler,a),d=b(this,c);v(this),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}function e(b,d,e){this.bufferSize=null==b?f:b,this.windowSize=null==d?f:d,this.scheduler=e||r,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,c)}var f=Math.pow(2,53)-1;return t(e,a),u(e.prototype,l.prototype,{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(v(this),!this.isStopped){var b=this.scheduler.now();this.q.push({interval:b,value:a}),this._trim(b);for(var c=0,e=d(this.observers),f=e.length;f>c;c++){var g=e[c];g.onNext(a),g.ensureActive()}}},onError:function(a){if(v(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var b=this.scheduler.now();this._trim(b);for(var c=0,e=d(this.observers),f=e.length;f>c;c++){var g=e[c];g.onError(a),g.ensureActive()}this.observers.length=0}},onCompleted:function(){if(v(this),!this.isStopped){this.isStopped=!0;var a=this.scheduler.now();this._trim(a);for(var b=0,c=d(this.observers),e=c.length;e>b;b++){var f=c[b];f.onCompleted(),f.ensureActive()}this.observers.length=0}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(i),E=c.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new p(f.subscribe(c),n(function(){e=!1}))),d},a.call(this,function(a){return c.subscribe(a)})}return t(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new k(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(i);return c});
|
3
|
+
//# sourceMappingURL=rx.core.binding.map
|
@@ -0,0 +1,1281 @@
|
|
1
|
+
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
|
+
|
3
|
+
;(function (undefined) {
|
4
|
+
|
5
|
+
var objectTypes = {
|
6
|
+
'function': true,
|
7
|
+
'object': true
|
8
|
+
};
|
9
|
+
|
10
|
+
var
|
11
|
+
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
|
12
|
+
freeSelf = objectTypes[typeof self] && self.Object && self,
|
13
|
+
freeWindow = objectTypes[typeof window] && window && window.Object && window,
|
14
|
+
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
|
15
|
+
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
|
16
|
+
freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;
|
17
|
+
|
18
|
+
var root = root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;
|
19
|
+
|
20
|
+
var Rx = {
|
21
|
+
internals: {},
|
22
|
+
config: {
|
23
|
+
Promise: root.Promise
|
24
|
+
},
|
25
|
+
helpers: { }
|
26
|
+
};
|
27
|
+
|
28
|
+
// Defaults
|
29
|
+
var
|
30
|
+
noop = Rx.helpers.noop = function () { },
|
31
|
+
defaultNow = Rx.helpers.defaultNow = (function () { return !!Date.now ? Date.now : function () { return +new Date; }; }()),
|
32
|
+
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
|
33
|
+
isPromise = Rx.helpers.isPromise = function (p) { return !!p && !isFunction(p.subscribe) && isFunction(p.then); },
|
34
|
+
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); }
|
35
|
+
isFunction = Rx.helpers.isFunction = (function () {
|
36
|
+
var isFn = function (value) {
|
37
|
+
return typeof value == 'function' || false;
|
38
|
+
}
|
39
|
+
|
40
|
+
// fallback for older versions of Chrome and Safari
|
41
|
+
if (isFn(/x/)) {
|
42
|
+
isFn = function(value) {
|
43
|
+
return typeof value == 'function' && toString.call(value) == '[object Function]';
|
44
|
+
};
|
45
|
+
}
|
46
|
+
return isFn;
|
47
|
+
}());
|
48
|
+
|
49
|
+
var NotImplementedError = Rx.NotImplementedError = function (message) {
|
50
|
+
this.message = message || 'This operation is not implemented';
|
51
|
+
Error.call(this);
|
52
|
+
};
|
53
|
+
NotImplementedError.prototype = Error.prototype;
|
54
|
+
|
55
|
+
var NotSupportedError = Rx.NotSupportedError = function (message) {
|
56
|
+
this.message = message || 'This operation is not supported';
|
57
|
+
Error.call(this);
|
58
|
+
};
|
59
|
+
NotSupportedError.prototype = Error.prototype;
|
60
|
+
|
61
|
+
var notImplemented = Rx.helpers.notImplemented = function () {
|
62
|
+
throw new NotImplementedError();
|
63
|
+
};
|
64
|
+
|
65
|
+
var notSupported = Rx.helpers.notSupported = function () {
|
66
|
+
throw new NotSupportedError();
|
67
|
+
};
|
68
|
+
|
69
|
+
var errorObj = {e: {}};
|
70
|
+
var tryCatchTarget;
|
71
|
+
function tryCatcher() {
|
72
|
+
try {
|
73
|
+
return tryCatchTarget.apply(this, arguments);
|
74
|
+
} catch (e) {
|
75
|
+
errorObj.e = e;
|
76
|
+
return errorObj;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
function tryCatch(fn) {
|
80
|
+
if (!isFunction(fn)) { throw new TypeError('fn must be a function'); }
|
81
|
+
tryCatchTarget = fn;
|
82
|
+
return tryCatcher;
|
83
|
+
}
|
84
|
+
function thrower(e) {
|
85
|
+
throw e;
|
86
|
+
}
|
87
|
+
|
88
|
+
Rx.config.longStackSupport = false;
|
89
|
+
var hasStacks = false, stacks = tryCatch(function () { throw new Error(); })();
|
90
|
+
hasStacks = !!stacks.e && !!stacks.e.stack;
|
91
|
+
|
92
|
+
// All code after this point will be filtered from stack traces reported by RxJS
|
93
|
+
var rStartingLine = captureLine(), rFileName;
|
94
|
+
|
95
|
+
var STACK_JUMP_SEPARATOR = 'From previous event:';
|
96
|
+
|
97
|
+
function makeStackTraceLong(error, observable) {
|
98
|
+
// If possible, transform the error stack trace by removing Node and RxJS
|
99
|
+
// cruft, then concatenating with the stack trace of `observable`.
|
100
|
+
if (hasStacks &&
|
101
|
+
observable.stack &&
|
102
|
+
typeof error === 'object' &&
|
103
|
+
error !== null &&
|
104
|
+
error.stack &&
|
105
|
+
error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1
|
106
|
+
) {
|
107
|
+
var stacks = [];
|
108
|
+
for (var o = observable; !!o; o = o.source) {
|
109
|
+
if (o.stack) {
|
110
|
+
stacks.unshift(o.stack);
|
111
|
+
}
|
112
|
+
}
|
113
|
+
stacks.unshift(error.stack);
|
114
|
+
|
115
|
+
var concatedStacks = stacks.join('\n' + STACK_JUMP_SEPARATOR + '\n');
|
116
|
+
error.stack = filterStackString(concatedStacks);
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
function filterStackString(stackString) {
|
121
|
+
var lines = stackString.split('\n'), desiredLines = [];
|
122
|
+
for (var i = 0, len = lines.length; i < len; i++) {
|
123
|
+
var line = lines[i];
|
124
|
+
|
125
|
+
if (!isInternalFrame(line) && !isNodeFrame(line) && line) {
|
126
|
+
desiredLines.push(line);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
return desiredLines.join('\n');
|
130
|
+
}
|
131
|
+
|
132
|
+
function isInternalFrame(stackLine) {
|
133
|
+
var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine);
|
134
|
+
if (!fileNameAndLineNumber) {
|
135
|
+
return false;
|
136
|
+
}
|
137
|
+
var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1];
|
138
|
+
|
139
|
+
return fileName === rFileName &&
|
140
|
+
lineNumber >= rStartingLine &&
|
141
|
+
lineNumber <= rEndingLine;
|
142
|
+
}
|
143
|
+
|
144
|
+
function isNodeFrame(stackLine) {
|
145
|
+
return stackLine.indexOf('(module.js:') !== -1 ||
|
146
|
+
stackLine.indexOf('(node.js:') !== -1;
|
147
|
+
}
|
148
|
+
|
149
|
+
function captureLine() {
|
150
|
+
if (!hasStacks) { return; }
|
151
|
+
|
152
|
+
try {
|
153
|
+
throw new Error();
|
154
|
+
} catch (e) {
|
155
|
+
var lines = e.stack.split('\n');
|
156
|
+
var firstLine = lines[0].indexOf('@') > 0 ? lines[1] : lines[2];
|
157
|
+
var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine);
|
158
|
+
if (!fileNameAndLineNumber) { return; }
|
159
|
+
|
160
|
+
rFileName = fileNameAndLineNumber[0];
|
161
|
+
return fileNameAndLineNumber[1];
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
function getFileNameAndLineNumber(stackLine) {
|
166
|
+
// Named functions: 'at functionName (filename:lineNumber:columnNumber)'
|
167
|
+
var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine);
|
168
|
+
if (attempt1) { return [attempt1[1], Number(attempt1[2])]; }
|
169
|
+
|
170
|
+
// Anonymous functions: 'at filename:lineNumber:columnNumber'
|
171
|
+
var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine);
|
172
|
+
if (attempt2) { return [attempt2[1], Number(attempt2[2])]; }
|
173
|
+
|
174
|
+
// Firefox style: 'function@filename:lineNumber or @filename:lineNumber'
|
175
|
+
var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine);
|
176
|
+
if (attempt3) { return [attempt3[1], Number(attempt3[2])]; }
|
177
|
+
}
|
178
|
+
|
179
|
+
var hasProp = {}.hasOwnProperty,
|
180
|
+
slice = Array.prototype.slice;
|
181
|
+
|
182
|
+
var inherits = Rx.internals.inherits = function (child, parent) {
|
183
|
+
function __() { this.constructor = child; }
|
184
|
+
__.prototype = parent.prototype;
|
185
|
+
child.prototype = new __();
|
186
|
+
};
|
187
|
+
|
188
|
+
var addProperties = Rx.internals.addProperties = function (obj) {
|
189
|
+
for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); }
|
190
|
+
for (var idx = 0, ln = sources.length; idx < ln; idx++) {
|
191
|
+
var source = sources[idx];
|
192
|
+
for (var prop in source) {
|
193
|
+
obj[prop] = source[prop];
|
194
|
+
}
|
195
|
+
}
|
196
|
+
};
|
197
|
+
|
198
|
+
// Rx Utils
|
199
|
+
var addRef = Rx.internals.addRef = function (xs, r) {
|
200
|
+
return new AnonymousObservable(function (observer) {
|
201
|
+
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
|
202
|
+
});
|
203
|
+
};
|
204
|
+
|
205
|
+
function arrayInitialize(count, factory) {
|
206
|
+
var a = new Array(count);
|
207
|
+
for (var i = 0; i < count; i++) {
|
208
|
+
a[i] = factory();
|
209
|
+
}
|
210
|
+
return a;
|
211
|
+
}
|
212
|
+
|
213
|
+
/**
|
214
|
+
* Represents a group of disposable resources that are disposed together.
|
215
|
+
* @constructor
|
216
|
+
*/
|
217
|
+
var CompositeDisposable = Rx.CompositeDisposable = function () {
|
218
|
+
var args = [], i, len;
|
219
|
+
if (Array.isArray(arguments[0])) {
|
220
|
+
args = arguments[0];
|
221
|
+
len = args.length;
|
222
|
+
} else {
|
223
|
+
len = arguments.length;
|
224
|
+
args = new Array(len);
|
225
|
+
for(i = 0; i < len; i++) { args[i] = arguments[i]; }
|
226
|
+
}
|
227
|
+
for(i = 0; i < len; i++) {
|
228
|
+
if (!isDisposable(args[i])) { throw new TypeError('Not a disposable'); }
|
229
|
+
}
|
230
|
+
this.disposables = args;
|
231
|
+
this.isDisposed = false;
|
232
|
+
this.length = args.length;
|
233
|
+
};
|
234
|
+
|
235
|
+
var CompositeDisposablePrototype = CompositeDisposable.prototype;
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
|
239
|
+
* @param {Mixed} item Disposable to add.
|
240
|
+
*/
|
241
|
+
CompositeDisposablePrototype.add = function (item) {
|
242
|
+
if (this.isDisposed) {
|
243
|
+
item.dispose();
|
244
|
+
} else {
|
245
|
+
this.disposables.push(item);
|
246
|
+
this.length++;
|
247
|
+
}
|
248
|
+
};
|
249
|
+
|
250
|
+
/**
|
251
|
+
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
|
252
|
+
* @param {Mixed} item Disposable to remove.
|
253
|
+
* @returns {Boolean} true if found; false otherwise.
|
254
|
+
*/
|
255
|
+
CompositeDisposablePrototype.remove = function (item) {
|
256
|
+
var shouldDispose = false;
|
257
|
+
if (!this.isDisposed) {
|
258
|
+
var idx = this.disposables.indexOf(item);
|
259
|
+
if (idx !== -1) {
|
260
|
+
shouldDispose = true;
|
261
|
+
this.disposables.splice(idx, 1);
|
262
|
+
this.length--;
|
263
|
+
item.dispose();
|
264
|
+
}
|
265
|
+
}
|
266
|
+
return shouldDispose;
|
267
|
+
};
|
268
|
+
|
269
|
+
/**
|
270
|
+
* Disposes all disposables in the group and removes them from the group.
|
271
|
+
*/
|
272
|
+
CompositeDisposablePrototype.dispose = function () {
|
273
|
+
if (!this.isDisposed) {
|
274
|
+
this.isDisposed = true;
|
275
|
+
var len = this.disposables.length, currentDisposables = new Array(len);
|
276
|
+
for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; }
|
277
|
+
this.disposables = [];
|
278
|
+
this.length = 0;
|
279
|
+
|
280
|
+
for (i = 0; i < len; i++) {
|
281
|
+
currentDisposables[i].dispose();
|
282
|
+
}
|
283
|
+
}
|
284
|
+
};
|
285
|
+
|
286
|
+
/**
|
287
|
+
* Provides a set of static methods for creating Disposables.
|
288
|
+
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
|
289
|
+
*/
|
290
|
+
var Disposable = Rx.Disposable = function (action) {
|
291
|
+
this.isDisposed = false;
|
292
|
+
this.action = action || noop;
|
293
|
+
};
|
294
|
+
|
295
|
+
/** Performs the task of cleaning up resources. */
|
296
|
+
Disposable.prototype.dispose = function () {
|
297
|
+
if (!this.isDisposed) {
|
298
|
+
this.action();
|
299
|
+
this.isDisposed = true;
|
300
|
+
}
|
301
|
+
};
|
302
|
+
|
303
|
+
/**
|
304
|
+
* Creates a disposable object that invokes the specified action when disposed.
|
305
|
+
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
|
306
|
+
* @return {Disposable} The disposable object that runs the given action upon disposal.
|
307
|
+
*/
|
308
|
+
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
|
309
|
+
|
310
|
+
/**
|
311
|
+
* Gets the disposable that does nothing when disposed.
|
312
|
+
*/
|
313
|
+
var disposableEmpty = Disposable.empty = { dispose: noop };
|
314
|
+
|
315
|
+
/**
|
316
|
+
* Validates whether the given object is a disposable
|
317
|
+
* @param {Object} Object to test whether it has a dispose method
|
318
|
+
* @returns {Boolean} true if a disposable object, else false.
|
319
|
+
*/
|
320
|
+
var isDisposable = Disposable.isDisposable = function (d) {
|
321
|
+
return d && isFunction(d.dispose);
|
322
|
+
};
|
323
|
+
|
324
|
+
var checkDisposed = Disposable.checkDisposed = function (disposable) {
|
325
|
+
if (disposable.isDisposed) { throw new ObjectDisposedError(); }
|
326
|
+
};
|
327
|
+
|
328
|
+
// Single assignment
|
329
|
+
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () {
|
330
|
+
this.isDisposed = false;
|
331
|
+
this.current = null;
|
332
|
+
};
|
333
|
+
SingleAssignmentDisposable.prototype.getDisposable = function () {
|
334
|
+
return this.current;
|
335
|
+
};
|
336
|
+
SingleAssignmentDisposable.prototype.setDisposable = function (value) {
|
337
|
+
if (this.current) { throw new Error('Disposable has already been assigned'); }
|
338
|
+
var shouldDispose = this.isDisposed;
|
339
|
+
!shouldDispose && (this.current = value);
|
340
|
+
shouldDispose && value && value.dispose();
|
341
|
+
};
|
342
|
+
SingleAssignmentDisposable.prototype.dispose = function () {
|
343
|
+
if (!this.isDisposed) {
|
344
|
+
this.isDisposed = true;
|
345
|
+
var old = this.current;
|
346
|
+
this.current = null;
|
347
|
+
}
|
348
|
+
old && old.dispose();
|
349
|
+
};
|
350
|
+
|
351
|
+
// Multiple assignment disposable
|
352
|
+
var SerialDisposable = Rx.SerialDisposable = function () {
|
353
|
+
this.isDisposed = false;
|
354
|
+
this.current = null;
|
355
|
+
};
|
356
|
+
SerialDisposable.prototype.getDisposable = function () {
|
357
|
+
return this.current;
|
358
|
+
};
|
359
|
+
SerialDisposable.prototype.setDisposable = function (value) {
|
360
|
+
var shouldDispose = this.isDisposed;
|
361
|
+
if (!shouldDispose) {
|
362
|
+
var old = this.current;
|
363
|
+
this.current = value;
|
364
|
+
}
|
365
|
+
old && old.dispose();
|
366
|
+
shouldDispose && value && value.dispose();
|
367
|
+
};
|
368
|
+
SerialDisposable.prototype.dispose = function () {
|
369
|
+
if (!this.isDisposed) {
|
370
|
+
this.isDisposed = true;
|
371
|
+
var old = this.current;
|
372
|
+
this.current = null;
|
373
|
+
}
|
374
|
+
old && old.dispose();
|
375
|
+
};
|
376
|
+
|
377
|
+
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
|
378
|
+
this.scheduler = scheduler;
|
379
|
+
this.state = state;
|
380
|
+
this.action = action;
|
381
|
+
this.dueTime = dueTime;
|
382
|
+
this.comparer = comparer || defaultSubComparer;
|
383
|
+
this.disposable = new SingleAssignmentDisposable();
|
384
|
+
}
|
385
|
+
|
386
|
+
ScheduledItem.prototype.invoke = function () {
|
387
|
+
this.disposable.setDisposable(this.invokeCore());
|
388
|
+
};
|
389
|
+
|
390
|
+
ScheduledItem.prototype.compareTo = function (other) {
|
391
|
+
return this.comparer(this.dueTime, other.dueTime);
|
392
|
+
};
|
393
|
+
|
394
|
+
ScheduledItem.prototype.isCancelled = function () {
|
395
|
+
return this.disposable.isDisposed;
|
396
|
+
};
|
397
|
+
|
398
|
+
ScheduledItem.prototype.invokeCore = function () {
|
399
|
+
return this.action(this.scheduler, this.state);
|
400
|
+
};
|
401
|
+
|
402
|
+
/** Provides a set of static properties to access commonly used schedulers. */
|
403
|
+
var Scheduler = Rx.Scheduler = (function () {
|
404
|
+
|
405
|
+
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
|
406
|
+
this.now = now;
|
407
|
+
this._schedule = schedule;
|
408
|
+
this._scheduleRelative = scheduleRelative;
|
409
|
+
this._scheduleAbsolute = scheduleAbsolute;
|
410
|
+
}
|
411
|
+
|
412
|
+
/** Determines whether the given object is a scheduler */
|
413
|
+
Scheduler.isScheduler = function (s) {
|
414
|
+
return s instanceof Scheduler;
|
415
|
+
}
|
416
|
+
|
417
|
+
function invokeAction(scheduler, action) {
|
418
|
+
action();
|
419
|
+
return disposableEmpty;
|
420
|
+
}
|
421
|
+
|
422
|
+
var schedulerProto = Scheduler.prototype;
|
423
|
+
|
424
|
+
/**
|
425
|
+
* Schedules an action to be executed.
|
426
|
+
* @param {Function} action Action to execute.
|
427
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
428
|
+
*/
|
429
|
+
schedulerProto.schedule = function (action) {
|
430
|
+
return this._schedule(action, invokeAction);
|
431
|
+
};
|
432
|
+
|
433
|
+
/**
|
434
|
+
* Schedules an action to be executed.
|
435
|
+
* @param state State passed to the action to be executed.
|
436
|
+
* @param {Function} action Action to be executed.
|
437
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
438
|
+
*/
|
439
|
+
schedulerProto.scheduleWithState = function (state, action) {
|
440
|
+
return this._schedule(state, action);
|
441
|
+
};
|
442
|
+
|
443
|
+
/**
|
444
|
+
* Schedules an action to be executed after the specified relative due time.
|
445
|
+
* @param {Function} action Action to execute.
|
446
|
+
* @param {Number} dueTime Relative time after which to execute the action.
|
447
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
448
|
+
*/
|
449
|
+
schedulerProto.scheduleWithRelative = function (dueTime, action) {
|
450
|
+
return this._scheduleRelative(action, dueTime, invokeAction);
|
451
|
+
};
|
452
|
+
|
453
|
+
/**
|
454
|
+
* Schedules an action to be executed after dueTime.
|
455
|
+
* @param state State passed to the action to be executed.
|
456
|
+
* @param {Function} action Action to be executed.
|
457
|
+
* @param {Number} dueTime Relative time after which to execute the action.
|
458
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
459
|
+
*/
|
460
|
+
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
|
461
|
+
return this._scheduleRelative(state, dueTime, action);
|
462
|
+
};
|
463
|
+
|
464
|
+
/**
|
465
|
+
* Schedules an action to be executed at the specified absolute due time.
|
466
|
+
* @param {Function} action Action to execute.
|
467
|
+
* @param {Number} dueTime Absolute time at which to execute the action.
|
468
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
469
|
+
*/
|
470
|
+
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
|
471
|
+
return this._scheduleAbsolute(action, dueTime, invokeAction);
|
472
|
+
};
|
473
|
+
|
474
|
+
/**
|
475
|
+
* Schedules an action to be executed at dueTime.
|
476
|
+
* @param {Mixed} state State passed to the action to be executed.
|
477
|
+
* @param {Function} action Action to be executed.
|
478
|
+
* @param {Number}dueTime Absolute time at which to execute the action.
|
479
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
480
|
+
*/
|
481
|
+
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
|
482
|
+
return this._scheduleAbsolute(state, dueTime, action);
|
483
|
+
};
|
484
|
+
|
485
|
+
/** Gets the current time according to the local machine's system clock. */
|
486
|
+
Scheduler.now = defaultNow;
|
487
|
+
|
488
|
+
/**
|
489
|
+
* Normalizes the specified TimeSpan value to a positive value.
|
490
|
+
* @param {Number} timeSpan The time span value to normalize.
|
491
|
+
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
|
492
|
+
*/
|
493
|
+
Scheduler.normalize = function (timeSpan) {
|
494
|
+
timeSpan < 0 && (timeSpan = 0);
|
495
|
+
return timeSpan;
|
496
|
+
};
|
497
|
+
|
498
|
+
return Scheduler;
|
499
|
+
}());
|
500
|
+
|
501
|
+
var normalizeTime = Scheduler.normalize, isScheduler = Scheduler.isScheduler;
|
502
|
+
|
503
|
+
(function (schedulerProto) {
|
504
|
+
|
505
|
+
function invokeRecImmediate(scheduler, pair) {
|
506
|
+
var state = pair[0], action = pair[1], group = new CompositeDisposable();
|
507
|
+
action(state, innerAction);
|
508
|
+
return group;
|
509
|
+
|
510
|
+
function innerAction(state2) {
|
511
|
+
var isAdded = false, isDone = false;
|
512
|
+
|
513
|
+
var d = scheduler.scheduleWithState(state2, scheduleWork);
|
514
|
+
if (!isDone) {
|
515
|
+
group.add(d);
|
516
|
+
isAdded = true;
|
517
|
+
}
|
518
|
+
|
519
|
+
function scheduleWork(_, state3) {
|
520
|
+
if (isAdded) {
|
521
|
+
group.remove(d);
|
522
|
+
} else {
|
523
|
+
isDone = true;
|
524
|
+
}
|
525
|
+
action(state3, innerAction);
|
526
|
+
return disposableEmpty;
|
527
|
+
}
|
528
|
+
}
|
529
|
+
}
|
530
|
+
|
531
|
+
function invokeRecDate(scheduler, pair, method) {
|
532
|
+
var state = pair[0], action = pair[1], group = new CompositeDisposable();
|
533
|
+
action(state, innerAction);
|
534
|
+
return group;
|
535
|
+
|
536
|
+
function innerAction(state2, dueTime1) {
|
537
|
+
var isAdded = false, isDone = false;
|
538
|
+
|
539
|
+
var d = scheduler[method](state2, dueTime1, scheduleWork);
|
540
|
+
if (!isDone) {
|
541
|
+
group.add(d);
|
542
|
+
isAdded = true;
|
543
|
+
}
|
544
|
+
|
545
|
+
function scheduleWork(_, state3) {
|
546
|
+
if (isAdded) {
|
547
|
+
group.remove(d);
|
548
|
+
} else {
|
549
|
+
isDone = true;
|
550
|
+
}
|
551
|
+
action(state3, innerAction);
|
552
|
+
return disposableEmpty;
|
553
|
+
}
|
554
|
+
}
|
555
|
+
}
|
556
|
+
|
557
|
+
function invokeRecDateRelative(s, p) {
|
558
|
+
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
|
559
|
+
}
|
560
|
+
|
561
|
+
function invokeRecDateAbsolute(s, p) {
|
562
|
+
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
|
563
|
+
}
|
564
|
+
|
565
|
+
function scheduleInnerRecursive(action, self) {
|
566
|
+
action(function(dt) { self(action, dt); });
|
567
|
+
}
|
568
|
+
|
569
|
+
/**
|
570
|
+
* Schedules an action to be executed recursively.
|
571
|
+
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
|
572
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
573
|
+
*/
|
574
|
+
schedulerProto.scheduleRecursive = function (action) {
|
575
|
+
return this.scheduleRecursiveWithState(action, scheduleInnerRecursive);
|
576
|
+
};
|
577
|
+
|
578
|
+
/**
|
579
|
+
* Schedules an action to be executed recursively.
|
580
|
+
* @param {Mixed} state State passed to the action to be executed.
|
581
|
+
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
|
582
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
583
|
+
*/
|
584
|
+
schedulerProto.scheduleRecursiveWithState = function (state, action) {
|
585
|
+
return this.scheduleWithState([state, action], invokeRecImmediate);
|
586
|
+
};
|
587
|
+
|
588
|
+
/**
|
589
|
+
* Schedules an action to be executed recursively after a specified relative due time.
|
590
|
+
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
|
591
|
+
* @param {Number}dueTime Relative time after which to execute the action for the first time.
|
592
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
593
|
+
*/
|
594
|
+
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
|
595
|
+
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive);
|
596
|
+
};
|
597
|
+
|
598
|
+
/**
|
599
|
+
* Schedules an action to be executed recursively after a specified relative due time.
|
600
|
+
* @param {Mixed} state State passed to the action to be executed.
|
601
|
+
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
|
602
|
+
* @param {Number}dueTime Relative time after which to execute the action for the first time.
|
603
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
604
|
+
*/
|
605
|
+
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
|
606
|
+
return this._scheduleRelative([state, action], dueTime, invokeRecDateRelative);
|
607
|
+
};
|
608
|
+
|
609
|
+
/**
|
610
|
+
* Schedules an action to be executed recursively at a specified absolute due time.
|
611
|
+
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
|
612
|
+
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
|
613
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
614
|
+
*/
|
615
|
+
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
|
616
|
+
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive);
|
617
|
+
};
|
618
|
+
|
619
|
+
/**
|
620
|
+
* Schedules an action to be executed recursively at a specified absolute due time.
|
621
|
+
* @param {Mixed} state State passed to the action to be executed.
|
622
|
+
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
|
623
|
+
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
|
624
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
|
625
|
+
*/
|
626
|
+
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
|
627
|
+
return this._scheduleAbsolute([state, action], dueTime, invokeRecDateAbsolute);
|
628
|
+
};
|
629
|
+
}(Scheduler.prototype));
|
630
|
+
|
631
|
+
(function (schedulerProto) {
|
632
|
+
|
633
|
+
/**
|
634
|
+
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
|
635
|
+
* @param {Number} period Period for running the work periodically.
|
636
|
+
* @param {Function} action Action to be executed.
|
637
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
|
638
|
+
*/
|
639
|
+
Scheduler.prototype.schedulePeriodic = function (period, action) {
|
640
|
+
return this.schedulePeriodicWithState(null, period, action);
|
641
|
+
};
|
642
|
+
|
643
|
+
/**
|
644
|
+
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
|
645
|
+
* @param {Mixed} state Initial state passed to the action upon the first iteration.
|
646
|
+
* @param {Number} period Period for running the work periodically.
|
647
|
+
* @param {Function} action Action to be executed, potentially updating the state.
|
648
|
+
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
|
649
|
+
*/
|
650
|
+
Scheduler.prototype.schedulePeriodicWithState = function(state, period, action) {
|
651
|
+
if (typeof root.setInterval === 'undefined') { throw new NotSupportedError(); }
|
652
|
+
period = normalizeTime(period);
|
653
|
+
var s = state, id = root.setInterval(function () { s = action(s); }, period);
|
654
|
+
return disposableCreate(function () { root.clearInterval(id); });
|
655
|
+
};
|
656
|
+
|
657
|
+
}(Scheduler.prototype));
|
658
|
+
|
659
|
+
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
|
660
|
+
function tick(command, recurse) {
|
661
|
+
recurse(0, this._period);
|
662
|
+
try {
|
663
|
+
this._state = this._action(this._state);
|
664
|
+
} catch (e) {
|
665
|
+
this._cancel.dispose();
|
666
|
+
throw e;
|
667
|
+
}
|
668
|
+
}
|
669
|
+
|
670
|
+
function SchedulePeriodicRecursive(scheduler, state, period, action) {
|
671
|
+
this._scheduler = scheduler;
|
672
|
+
this._state = state;
|
673
|
+
this._period = period;
|
674
|
+
this._action = action;
|
675
|
+
}
|
676
|
+
|
677
|
+
SchedulePeriodicRecursive.prototype.start = function () {
|
678
|
+
var d = new SingleAssignmentDisposable();
|
679
|
+
this._cancel = d;
|
680
|
+
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
|
681
|
+
|
682
|
+
return d;
|
683
|
+
};
|
684
|
+
|
685
|
+
return SchedulePeriodicRecursive;
|
686
|
+
}());
|
687
|
+
|
688
|
+
/** Gets a scheduler that schedules work immediately on the current thread. */
|
689
|
+
var immediateScheduler = Scheduler.immediate = (function () {
|
690
|
+
function scheduleNow(state, action) { return action(this, state); }
|
691
|
+
return new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
|
692
|
+
}());
|
693
|
+
|
694
|
+
/**
|
695
|
+
* Gets a scheduler that schedules work as soon as possible on the current thread.
|
696
|
+
*/
|
697
|
+
var currentThreadScheduler = Scheduler.currentThread = (function () {
|
698
|
+
var queue;
|
699
|
+
|
700
|
+
function runTrampoline () {
|
701
|
+
while (queue.length > 0) {
|
702
|
+
var item = queue.shift();
|
703
|
+
!item.isCancelled() && item.invoke();
|
704
|
+
}
|
705
|
+
}
|
706
|
+
|
707
|
+
function scheduleNow(state, action) {
|
708
|
+
var si = new ScheduledItem(this, state, action, this.now());
|
709
|
+
|
710
|
+
if (!queue) {
|
711
|
+
queue = [si];
|
712
|
+
|
713
|
+
var result = tryCatch(runTrampoline)();
|
714
|
+
queue = null;
|
715
|
+
if (result === errorObj) { return thrower(result.e); }
|
716
|
+
} else {
|
717
|
+
queue.push(si);
|
718
|
+
}
|
719
|
+
return si.disposable;
|
720
|
+
}
|
721
|
+
|
722
|
+
var currentScheduler = new Scheduler(defaultNow, scheduleNow, notSupported, notSupported);
|
723
|
+
currentScheduler.scheduleRequired = function () { return !queue; };
|
724
|
+
|
725
|
+
return currentScheduler;
|
726
|
+
}());
|
727
|
+
|
728
|
+
var scheduleMethod, clearMethod;
|
729
|
+
|
730
|
+
var localTimer = (function () {
|
731
|
+
var localSetTimeout, localClearTimeout = noop;
|
732
|
+
if (!!root.setTimeout) {
|
733
|
+
localSetTimeout = root.setTimeout;
|
734
|
+
localClearTimeout = root.clearTimeout;
|
735
|
+
} else if (!!root.WScript) {
|
736
|
+
localSetTimeout = function (fn, time) {
|
737
|
+
root.WScript.Sleep(time);
|
738
|
+
fn();
|
739
|
+
};
|
740
|
+
} else {
|
741
|
+
throw new NotSupportedError();
|
742
|
+
}
|
743
|
+
|
744
|
+
return {
|
745
|
+
setTimeout: localSetTimeout,
|
746
|
+
clearTimeout: localClearTimeout
|
747
|
+
};
|
748
|
+
}());
|
749
|
+
var localSetTimeout = localTimer.setTimeout,
|
750
|
+
localClearTimeout = localTimer.clearTimeout;
|
751
|
+
|
752
|
+
(function () {
|
753
|
+
|
754
|
+
var nextHandle = 1, tasksByHandle = {}, currentlyRunning = false;
|
755
|
+
|
756
|
+
clearMethod = function (handle) {
|
757
|
+
delete tasksByHandle[handle];
|
758
|
+
};
|
759
|
+
|
760
|
+
function runTask(handle) {
|
761
|
+
if (currentlyRunning) {
|
762
|
+
localSetTimeout(function () { runTask(handle) }, 0);
|
763
|
+
} else {
|
764
|
+
var task = tasksByHandle[handle];
|
765
|
+
if (task) {
|
766
|
+
currentlyRunning = true;
|
767
|
+
var result = tryCatch(task)();
|
768
|
+
clearMethod(handle);
|
769
|
+
currentlyRunning = false;
|
770
|
+
if (result === errorObj) { return thrower(result.e); }
|
771
|
+
}
|
772
|
+
}
|
773
|
+
}
|
774
|
+
|
775
|
+
var reNative = RegExp('^' +
|
776
|
+
String(toString)
|
777
|
+
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
778
|
+
.replace(/toString| for [^\]]+/g, '.*?') + '$'
|
779
|
+
);
|
780
|
+
|
781
|
+
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
|
782
|
+
!reNative.test(setImmediate) && setImmediate;
|
783
|
+
|
784
|
+
function postMessageSupported () {
|
785
|
+
// Ensure not in a worker
|
786
|
+
if (!root.postMessage || root.importScripts) { return false; }
|
787
|
+
var isAsync = false, oldHandler = root.onmessage;
|
788
|
+
// Test for async
|
789
|
+
root.onmessage = function () { isAsync = true; };
|
790
|
+
root.postMessage('', '*');
|
791
|
+
root.onmessage = oldHandler;
|
792
|
+
|
793
|
+
return isAsync;
|
794
|
+
}
|
795
|
+
|
796
|
+
// Use in order, setImmediate, nextTick, postMessage, MessageChannel, script readystatechanged, setTimeout
|
797
|
+
if (isFunction(setImmediate)) {
|
798
|
+
scheduleMethod = function (action) {
|
799
|
+
var id = nextHandle++;
|
800
|
+
tasksByHandle[id] = action;
|
801
|
+
setImmediate(function () { runTask(id); });
|
802
|
+
|
803
|
+
return id;
|
804
|
+
};
|
805
|
+
} else if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
|
806
|
+
scheduleMethod = function (action) {
|
807
|
+
var id = nextHandle++;
|
808
|
+
tasksByHandle[id] = action;
|
809
|
+
process.nextTick(function () { runTask(id); });
|
810
|
+
|
811
|
+
return id;
|
812
|
+
};
|
813
|
+
} else if (postMessageSupported()) {
|
814
|
+
var MSG_PREFIX = 'ms.rx.schedule' + Math.random();
|
815
|
+
|
816
|
+
function onGlobalPostMessage(event) {
|
817
|
+
// Only if we're a match to avoid any other global events
|
818
|
+
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
|
819
|
+
runTask(event.data.substring(MSG_PREFIX.length));
|
820
|
+
}
|
821
|
+
}
|
822
|
+
|
823
|
+
if (root.addEventListener) {
|
824
|
+
root.addEventListener('message', onGlobalPostMessage, false);
|
825
|
+
} else if (root.attachEvent) {
|
826
|
+
root.attachEvent('onmessage', onGlobalPostMessage);
|
827
|
+
} else {
|
828
|
+
root.onmessage = onGlobalPostMessage;
|
829
|
+
}
|
830
|
+
|
831
|
+
scheduleMethod = function (action) {
|
832
|
+
var id = nextHandle++;
|
833
|
+
tasksByHandle[id] = action;
|
834
|
+
root.postMessage(MSG_PREFIX + currentId, '*');
|
835
|
+
return id;
|
836
|
+
};
|
837
|
+
} else if (!!root.MessageChannel) {
|
838
|
+
var channel = new root.MessageChannel();
|
839
|
+
|
840
|
+
channel.port1.onmessage = function (e) { runTask(e.data); };
|
841
|
+
|
842
|
+
scheduleMethod = function (action) {
|
843
|
+
var id = nextHandle++;
|
844
|
+
tasksByHandle[id] = action;
|
845
|
+
channel.port2.postMessage(id);
|
846
|
+
return id;
|
847
|
+
};
|
848
|
+
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
|
849
|
+
|
850
|
+
scheduleMethod = function (action) {
|
851
|
+
var scriptElement = root.document.createElement('script');
|
852
|
+
var id = nextHandle++;
|
853
|
+
tasksByHandle[id] = action;
|
854
|
+
|
855
|
+
scriptElement.onreadystatechange = function () {
|
856
|
+
runTask(id);
|
857
|
+
scriptElement.onreadystatechange = null;
|
858
|
+
scriptElement.parentNode.removeChild(scriptElement);
|
859
|
+
scriptElement = null;
|
860
|
+
};
|
861
|
+
root.document.documentElement.appendChild(scriptElement);
|
862
|
+
return id;
|
863
|
+
};
|
864
|
+
|
865
|
+
} else {
|
866
|
+
scheduleMethod = function (action) {
|
867
|
+
var id = nextHandle++;
|
868
|
+
tasksByHandle[id] = action;
|
869
|
+
localSetTimeout(function () {
|
870
|
+
runTask(id);
|
871
|
+
}, 0);
|
872
|
+
|
873
|
+
return id;
|
874
|
+
};
|
875
|
+
}
|
876
|
+
}());
|
877
|
+
|
878
|
+
/**
|
879
|
+
* Gets a scheduler that schedules work via a timed callback based upon platform.
|
880
|
+
*/
|
881
|
+
var timeoutScheduler = Scheduler.timeout = Scheduler['default'] = (function () {
|
882
|
+
|
883
|
+
function scheduleNow(state, action) {
|
884
|
+
var scheduler = this, disposable = new SingleAssignmentDisposable();
|
885
|
+
var id = scheduleMethod(function () {
|
886
|
+
!disposable.isDisposed && disposable.setDisposable(action(scheduler, state));
|
887
|
+
});
|
888
|
+
return new CompositeDisposable(disposable, disposableCreate(function () {
|
889
|
+
clearMethod(id);
|
890
|
+
}));
|
891
|
+
}
|
892
|
+
|
893
|
+
function scheduleRelative(state, dueTime, action) {
|
894
|
+
var scheduler = this, dt = Scheduler.normalize(dueTime), disposable = new SingleAssignmentDisposable();
|
895
|
+
if (dt === 0) { return scheduler.scheduleWithState(state, action); }
|
896
|
+
var id = localSetTimeout(function () {
|
897
|
+
!disposable.isDisposed && disposable.setDisposable(action(scheduler, state));
|
898
|
+
}, dt);
|
899
|
+
return new CompositeDisposable(disposable, disposableCreate(function () {
|
900
|
+
localClearTimeout(id);
|
901
|
+
}));
|
902
|
+
}
|
903
|
+
|
904
|
+
function scheduleAbsolute(state, dueTime, action) {
|
905
|
+
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
|
906
|
+
}
|
907
|
+
|
908
|
+
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
909
|
+
})();
|
910
|
+
|
911
|
+
/**
|
912
|
+
* Supports push-style iteration over an observable sequence.
|
913
|
+
*/
|
914
|
+
var Observer = Rx.Observer = function () { };
|
915
|
+
|
916
|
+
/**
|
917
|
+
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
|
918
|
+
* @param {Function} [onNext] Observer's OnNext action implementation.
|
919
|
+
* @param {Function} [onError] Observer's OnError action implementation.
|
920
|
+
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
|
921
|
+
* @returns {Observer} The observer object implemented using the given actions.
|
922
|
+
*/
|
923
|
+
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
|
924
|
+
onNext || (onNext = noop);
|
925
|
+
onError || (onError = defaultError);
|
926
|
+
onCompleted || (onCompleted = noop);
|
927
|
+
return new AnonymousObserver(onNext, onError, onCompleted);
|
928
|
+
};
|
929
|
+
|
930
|
+
/**
|
931
|
+
* Abstract base class for implementations of the Observer class.
|
932
|
+
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
|
933
|
+
*/
|
934
|
+
var AbstractObserver = Rx.internals.AbstractObserver = (function (__super__) {
|
935
|
+
inherits(AbstractObserver, __super__);
|
936
|
+
|
937
|
+
/**
|
938
|
+
* Creates a new observer in a non-stopped state.
|
939
|
+
*/
|
940
|
+
function AbstractObserver() {
|
941
|
+
this.isStopped = false;
|
942
|
+
}
|
943
|
+
|
944
|
+
// Must be implemented by other observers
|
945
|
+
AbstractObserver.prototype.next = notImplemented;
|
946
|
+
AbstractObserver.prototype.error = notImplemented;
|
947
|
+
AbstractObserver.prototype.completed = notImplemented;
|
948
|
+
|
949
|
+
/**
|
950
|
+
* Notifies the observer of a new element in the sequence.
|
951
|
+
* @param {Any} value Next element in the sequence.
|
952
|
+
*/
|
953
|
+
AbstractObserver.prototype.onNext = function (value) {
|
954
|
+
!this.isStopped && this.next(value);
|
955
|
+
};
|
956
|
+
|
957
|
+
/**
|
958
|
+
* Notifies the observer that an exception has occurred.
|
959
|
+
* @param {Any} error The error that has occurred.
|
960
|
+
*/
|
961
|
+
AbstractObserver.prototype.onError = function (error) {
|
962
|
+
if (!this.isStopped) {
|
963
|
+
this.isStopped = true;
|
964
|
+
this.error(error);
|
965
|
+
}
|
966
|
+
};
|
967
|
+
|
968
|
+
/**
|
969
|
+
* Notifies the observer of the end of the sequence.
|
970
|
+
*/
|
971
|
+
AbstractObserver.prototype.onCompleted = function () {
|
972
|
+
if (!this.isStopped) {
|
973
|
+
this.isStopped = true;
|
974
|
+
this.completed();
|
975
|
+
}
|
976
|
+
};
|
977
|
+
|
978
|
+
/**
|
979
|
+
* Disposes the observer, causing it to transition to the stopped state.
|
980
|
+
*/
|
981
|
+
AbstractObserver.prototype.dispose = function () { this.isStopped = true; };
|
982
|
+
|
983
|
+
AbstractObserver.prototype.fail = function (e) {
|
984
|
+
if (!this.isStopped) {
|
985
|
+
this.isStopped = true;
|
986
|
+
this.error(e);
|
987
|
+
return true;
|
988
|
+
}
|
989
|
+
|
990
|
+
return false;
|
991
|
+
};
|
992
|
+
|
993
|
+
return AbstractObserver;
|
994
|
+
}(Observer));
|
995
|
+
|
996
|
+
/**
|
997
|
+
* Class to create an Observer instance from delegate-based implementations of the on* methods.
|
998
|
+
*/
|
999
|
+
var AnonymousObserver = Rx.AnonymousObserver = (function (__super__) {
|
1000
|
+
inherits(AnonymousObserver, __super__);
|
1001
|
+
|
1002
|
+
/**
|
1003
|
+
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
|
1004
|
+
* @param {Any} onNext Observer's OnNext action implementation.
|
1005
|
+
* @param {Any} onError Observer's OnError action implementation.
|
1006
|
+
* @param {Any} onCompleted Observer's OnCompleted action implementation.
|
1007
|
+
*/
|
1008
|
+
function AnonymousObserver(onNext, onError, onCompleted) {
|
1009
|
+
__super__.call(this);
|
1010
|
+
this._onNext = onNext;
|
1011
|
+
this._onError = onError;
|
1012
|
+
this._onCompleted = onCompleted;
|
1013
|
+
}
|
1014
|
+
|
1015
|
+
/**
|
1016
|
+
* Calls the onNext action.
|
1017
|
+
* @param {Any} value Next element in the sequence.
|
1018
|
+
*/
|
1019
|
+
AnonymousObserver.prototype.next = function (value) {
|
1020
|
+
this._onNext(value);
|
1021
|
+
};
|
1022
|
+
|
1023
|
+
/**
|
1024
|
+
* Calls the onError action.
|
1025
|
+
* @param {Any} error The error that has occurred.
|
1026
|
+
*/
|
1027
|
+
AnonymousObserver.prototype.error = function (error) {
|
1028
|
+
this._onError(error);
|
1029
|
+
};
|
1030
|
+
|
1031
|
+
/**
|
1032
|
+
* Calls the onCompleted action.
|
1033
|
+
*/
|
1034
|
+
AnonymousObserver.prototype.completed = function () {
|
1035
|
+
this._onCompleted();
|
1036
|
+
};
|
1037
|
+
|
1038
|
+
return AnonymousObserver;
|
1039
|
+
}(AbstractObserver));
|
1040
|
+
|
1041
|
+
var observableProto;
|
1042
|
+
|
1043
|
+
/**
|
1044
|
+
* Represents a push-style collection.
|
1045
|
+
*/
|
1046
|
+
var Observable = Rx.Observable = (function () {
|
1047
|
+
|
1048
|
+
function makeSubscribe(self, subscribe) {
|
1049
|
+
return function (o) {
|
1050
|
+
var oldOnError = o.onError;
|
1051
|
+
o.onError = function (e) {
|
1052
|
+
makeStackTraceLong(e, self);
|
1053
|
+
oldOnError.call(o, e);
|
1054
|
+
};
|
1055
|
+
|
1056
|
+
return subscribe.call(self, o);
|
1057
|
+
};
|
1058
|
+
}
|
1059
|
+
|
1060
|
+
function Observable(subscribe) {
|
1061
|
+
if (Rx.config.longStackSupport && hasStacks) {
|
1062
|
+
var e = tryCatch(thrower)(new Error()).e;
|
1063
|
+
this.stack = e.stack.substring(e.stack.indexOf('\n') + 1);
|
1064
|
+
this._subscribe = makeSubscribe(this, subscribe);
|
1065
|
+
} else {
|
1066
|
+
this._subscribe = subscribe;
|
1067
|
+
}
|
1068
|
+
}
|
1069
|
+
|
1070
|
+
observableProto = Observable.prototype;
|
1071
|
+
|
1072
|
+
/**
|
1073
|
+
* Determines whether the given object is an Observable
|
1074
|
+
* @param {Any} An object to determine whether it is an Observable
|
1075
|
+
* @returns {Boolean} true if an Observable, else false.
|
1076
|
+
*/
|
1077
|
+
Observable.isObservable = function (o) {
|
1078
|
+
return o && isFunction(o.subscribe);
|
1079
|
+
}
|
1080
|
+
|
1081
|
+
/**
|
1082
|
+
* Subscribes an o to the observable sequence.
|
1083
|
+
* @param {Mixed} [oOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
|
1084
|
+
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
|
1085
|
+
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
|
1086
|
+
* @returns {Diposable} A disposable handling the subscriptions and unsubscriptions.
|
1087
|
+
*/
|
1088
|
+
observableProto.subscribe = observableProto.forEach = function (oOrOnNext, onError, onCompleted) {
|
1089
|
+
return this._subscribe(typeof oOrOnNext === 'object' ?
|
1090
|
+
oOrOnNext :
|
1091
|
+
observerCreate(oOrOnNext, onError, onCompleted));
|
1092
|
+
};
|
1093
|
+
|
1094
|
+
/**
|
1095
|
+
* Subscribes to the next value in the sequence with an optional "this" argument.
|
1096
|
+
* @param {Function} onNext The function to invoke on each element in the observable sequence.
|
1097
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
1098
|
+
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
|
1099
|
+
*/
|
1100
|
+
observableProto.subscribeOnNext = function (onNext, thisArg) {
|
1101
|
+
return this._subscribe(observerCreate(typeof thisArg !== 'undefined' ? function(x) { onNext.call(thisArg, x); } : onNext));
|
1102
|
+
};
|
1103
|
+
|
1104
|
+
/**
|
1105
|
+
* Subscribes to an exceptional condition in the sequence with an optional "this" argument.
|
1106
|
+
* @param {Function} onError The function to invoke upon exceptional termination of the observable sequence.
|
1107
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
1108
|
+
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
|
1109
|
+
*/
|
1110
|
+
observableProto.subscribeOnError = function (onError, thisArg) {
|
1111
|
+
return this._subscribe(observerCreate(null, typeof thisArg !== 'undefined' ? function(e) { onError.call(thisArg, e); } : onError));
|
1112
|
+
};
|
1113
|
+
|
1114
|
+
/**
|
1115
|
+
* Subscribes to the next value in the sequence with an optional "this" argument.
|
1116
|
+
* @param {Function} onCompleted The function to invoke upon graceful termination of the observable sequence.
|
1117
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
1118
|
+
* @returns {Disposable} A disposable handling the subscriptions and unsubscriptions.
|
1119
|
+
*/
|
1120
|
+
observableProto.subscribeOnCompleted = function (onCompleted, thisArg) {
|
1121
|
+
return this._subscribe(observerCreate(null, null, typeof thisArg !== 'undefined' ? function() { onCompleted.call(thisArg); } : onCompleted));
|
1122
|
+
};
|
1123
|
+
|
1124
|
+
return Observable;
|
1125
|
+
})();
|
1126
|
+
|
1127
|
+
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
|
1128
|
+
inherits(AnonymousObservable, __super__);
|
1129
|
+
|
1130
|
+
// Fix subscriber to check for undefined or function returned to decorate as Disposable
|
1131
|
+
function fixSubscriber(subscriber) {
|
1132
|
+
return subscriber && isFunction(subscriber.dispose) ? subscriber :
|
1133
|
+
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
|
1134
|
+
}
|
1135
|
+
|
1136
|
+
function setDisposable(s, state) {
|
1137
|
+
var ado = state[0], self = state[1];
|
1138
|
+
var sub = tryCatch(self.__subscribe).call(self, ado);
|
1139
|
+
|
1140
|
+
if (sub === errorObj) {
|
1141
|
+
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
|
1142
|
+
}
|
1143
|
+
ado.setDisposable(fixSubscriber(sub));
|
1144
|
+
}
|
1145
|
+
|
1146
|
+
function innerSubscribe(observer) {
|
1147
|
+
var ado = new AutoDetachObserver(observer), state = [ado, this];
|
1148
|
+
|
1149
|
+
if (currentThreadScheduler.scheduleRequired()) {
|
1150
|
+
currentThreadScheduler.scheduleWithState(state, setDisposable);
|
1151
|
+
} else {
|
1152
|
+
setDisposable(null, state);
|
1153
|
+
}
|
1154
|
+
return ado;
|
1155
|
+
}
|
1156
|
+
|
1157
|
+
function AnonymousObservable(subscribe, parent) {
|
1158
|
+
this.source = parent;
|
1159
|
+
this.__subscribe = subscribe;
|
1160
|
+
__super__.call(this, innerSubscribe);
|
1161
|
+
}
|
1162
|
+
|
1163
|
+
return AnonymousObservable;
|
1164
|
+
|
1165
|
+
}(Observable));
|
1166
|
+
|
1167
|
+
var ObservableBase = Rx.ObservableBase = (function (__super__) {
|
1168
|
+
inherits(ObservableBase, __super__);
|
1169
|
+
|
1170
|
+
function fixSubscriber(subscriber) {
|
1171
|
+
return subscriber && isFunction(subscriber.dispose) ? subscriber :
|
1172
|
+
isFunction(subscriber) ? disposableCreate(subscriber) : disposableEmpty;
|
1173
|
+
}
|
1174
|
+
|
1175
|
+
function setDisposable(s, state) {
|
1176
|
+
var ado = state[0], self = state[1];
|
1177
|
+
var sub = tryCatch(self.subscribeCore).call(self, ado);
|
1178
|
+
|
1179
|
+
if (sub === errorObj) {
|
1180
|
+
if(!ado.fail(errorObj.e)) { return thrower(errorObj.e); }
|
1181
|
+
}
|
1182
|
+
ado.setDisposable(fixSubscriber(sub));
|
1183
|
+
}
|
1184
|
+
|
1185
|
+
function subscribe(observer) {
|
1186
|
+
var ado = new AutoDetachObserver(observer), state = [ado, this];
|
1187
|
+
|
1188
|
+
if (currentThreadScheduler.scheduleRequired()) {
|
1189
|
+
currentThreadScheduler.scheduleWithState(state, setDisposable);
|
1190
|
+
} else {
|
1191
|
+
setDisposable(null, state);
|
1192
|
+
}
|
1193
|
+
return ado;
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
function ObservableBase() {
|
1197
|
+
__super__.call(this, subscribe);
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
ObservableBase.prototype.subscribeCore = notImplemented;
|
1201
|
+
|
1202
|
+
return ObservableBase;
|
1203
|
+
}(Observable));
|
1204
|
+
|
1205
|
+
var AutoDetachObserver = (function (__super__) {
|
1206
|
+
inherits(AutoDetachObserver, __super__);
|
1207
|
+
|
1208
|
+
function AutoDetachObserver(observer) {
|
1209
|
+
__super__.call(this);
|
1210
|
+
this.observer = observer;
|
1211
|
+
this.m = new SingleAssignmentDisposable();
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
|
1215
|
+
|
1216
|
+
AutoDetachObserverPrototype.next = function (value) {
|
1217
|
+
var result = tryCatch(this.observer.onNext).call(this.observer, value);
|
1218
|
+
if (result === errorObj) {
|
1219
|
+
this.dispose();
|
1220
|
+
thrower(result.e);
|
1221
|
+
}
|
1222
|
+
};
|
1223
|
+
|
1224
|
+
AutoDetachObserverPrototype.error = function (err) {
|
1225
|
+
var result = tryCatch(this.observer.onError).call(this.observer, err);
|
1226
|
+
this.dispose();
|
1227
|
+
result === errorObj && thrower(result.e);
|
1228
|
+
};
|
1229
|
+
|
1230
|
+
AutoDetachObserverPrototype.completed = function () {
|
1231
|
+
var result = tryCatch(this.observer.onCompleted).call(this.observer);
|
1232
|
+
this.dispose();
|
1233
|
+
result === errorObj && thrower(result.e);
|
1234
|
+
};
|
1235
|
+
|
1236
|
+
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
|
1237
|
+
AutoDetachObserverPrototype.getDisposable = function () { return this.m.getDisposable(); };
|
1238
|
+
|
1239
|
+
AutoDetachObserverPrototype.dispose = function () {
|
1240
|
+
__super__.prototype.dispose.call(this);
|
1241
|
+
this.m.dispose();
|
1242
|
+
};
|
1243
|
+
|
1244
|
+
return AutoDetachObserver;
|
1245
|
+
}(AbstractObserver));
|
1246
|
+
|
1247
|
+
/**
|
1248
|
+
* Creates an observable sequence from a specified subscribe method implementation.
|
1249
|
+
* @example
|
1250
|
+
* var res = Rx.Observable.create(function (observer) { return function () { } );
|
1251
|
+
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
|
1252
|
+
* var res = Rx.Observable.create(function (observer) { } );
|
1253
|
+
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
|
1254
|
+
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
|
1255
|
+
*/
|
1256
|
+
Observable.create = function (subscribe, parent) {
|
1257
|
+
return new AnonymousObservable(subscribe, parent);
|
1258
|
+
};
|
1259
|
+
|
1260
|
+
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
|
1261
|
+
root.Rx = Rx;
|
1262
|
+
|
1263
|
+
define(function() {
|
1264
|
+
return Rx;
|
1265
|
+
});
|
1266
|
+
} else if (freeExports && freeModule) {
|
1267
|
+
// in Node.js or RingoJS
|
1268
|
+
if (moduleExports) {
|
1269
|
+
(freeModule.exports = Rx).Rx = Rx;
|
1270
|
+
} else {
|
1271
|
+
freeExports.Rx = Rx;
|
1272
|
+
}
|
1273
|
+
} else {
|
1274
|
+
// in a browser or Rhino
|
1275
|
+
root.Rx = Rx;
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
// All code before this point will be filtered from stack traces.
|
1279
|
+
var rEndingLine = captureLine();
|
1280
|
+
|
1281
|
+
}.call(this));
|