rxjs-rails 2.3.9 → 2.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rxjs/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/rx.aggregates.js +174 -204
  4. data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
  5. data/vendor/assets/javascripts/rx.all.compat.js +1626 -1528
  6. data/vendor/assets/javascripts/rx.all.compat.min.js +3 -3
  7. data/vendor/assets/javascripts/rx.all.js +1624 -1526
  8. data/vendor/assets/javascripts/rx.all.min.js +3 -3
  9. data/vendor/assets/javascripts/rx.async.compat.js +241 -0
  10. data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
  11. data/vendor/assets/javascripts/rx.async.js +241 -0
  12. data/vendor/assets/javascripts/rx.async.min.js +1 -1
  13. data/vendor/assets/javascripts/rx.backpressure.js +3 -3
  14. data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
  15. data/vendor/assets/javascripts/rx.binding.js +350 -378
  16. data/vendor/assets/javascripts/rx.binding.min.js +1 -1
  17. data/vendor/assets/javascripts/rx.coincidence.js +16 -21
  18. data/vendor/assets/javascripts/rx.compat.js +633 -683
  19. data/vendor/assets/javascripts/rx.compat.min.js +2 -2
  20. data/vendor/assets/javascripts/rx.js +633 -683
  21. data/vendor/assets/javascripts/rx.lite.compat.js +941 -1137
  22. data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
  23. data/vendor/assets/javascripts/rx.lite.extras.js +58 -74
  24. data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
  25. data/vendor/assets/javascripts/rx.lite.js +941 -1137
  26. data/vendor/assets/javascripts/rx.lite.min.js +2 -2
  27. data/vendor/assets/javascripts/rx.min.js +2 -2
  28. data/vendor/assets/javascripts/rx.time.js +182 -212
  29. data/vendor/assets/javascripts/rx.time.min.js +1 -1
  30. metadata +10 -10
@@ -47,6 +47,247 @@
47
47
  isScheduler = Rx.helpers.isScheduler,
48
48
  slice = Array.prototype.slice;
49
49
 
50
+ var fnString = 'function';
51
+
52
+ function toThunk(obj, ctx) {
53
+ if (Array.isArray(obj)) {
54
+ return objectToThunk.call(ctx, obj);
55
+ }
56
+
57
+ if (isGeneratorFunction(obj)) {
58
+ return observableSpawn(obj.call(ctx));
59
+ }
60
+
61
+ if (isGenerator(obj)) {
62
+ return observableSpawn(obj);
63
+ }
64
+
65
+ if (isObservable(obj)) {
66
+ return observableToThunk(obj);
67
+ }
68
+
69
+ if (isPromise(obj)) {
70
+ return promiseToThunk(obj);
71
+ }
72
+
73
+ if (typeof obj === fnString) {
74
+ return obj;
75
+ }
76
+
77
+ if (isObject(obj) || Array.isArray(obj)) {
78
+ return objectToThunk.call(ctx, obj);
79
+ }
80
+
81
+ return obj;
82
+ }
83
+
84
+ function objectToThunk(obj) {
85
+ var ctx = this;
86
+
87
+ return function (done) {
88
+ var keys = Object.keys(obj),
89
+ pending = keys.length,
90
+ results = new obj.constructor(),
91
+ finished;
92
+
93
+ if (!pending) {
94
+ timeoutScheduler.schedule(function () { done(null, results); });
95
+ return;
96
+ }
97
+
98
+ for (var i = 0, len = keys.length; i < len; i++) {
99
+ run(obj[keys[i]], keys[i]);
100
+ }
101
+
102
+ function run(fn, key) {
103
+ if (finished) { return; }
104
+ try {
105
+ fn = toThunk(fn, ctx);
106
+
107
+ if (typeof fn !== fnString) {
108
+ results[key] = fn;
109
+ return --pending || done(null, results);
110
+ }
111
+
112
+ fn.call(ctx, function(err, res){
113
+ if (finished) { return; }
114
+
115
+ if (err) {
116
+ finished = true;
117
+ return done(err);
118
+ }
119
+
120
+ results[key] = res;
121
+ --pending || done(null, results);
122
+ });
123
+ } catch (e) {
124
+ finished = true;
125
+ done(e);
126
+ }
127
+ }
128
+ }
129
+ }
130
+
131
+ function observableToThink(observable) {
132
+ return function (fn) {
133
+ var value, hasValue = false;
134
+ observable.subscribe(
135
+ function (v) {
136
+ value = v;
137
+ hasValue = true;
138
+ },
139
+ fn,
140
+ function () {
141
+ hasValue && fn(null, value);
142
+ });
143
+ }
144
+ }
145
+
146
+ function promiseToThunk(promise) {
147
+ return function(fn){
148
+ promise.then(function(res) {
149
+ fn(null, res);
150
+ }, fn);
151
+ }
152
+ }
153
+
154
+ function isObservable(obj) {
155
+ return obj && obj.prototype.subscribe === fnString;
156
+ }
157
+
158
+ function isGeneratorFunction(obj) {
159
+ return obj && obj.constructor && obj.constructor.name === 'GeneratorFunction';
160
+ }
161
+
162
+ function isGenerator(obj) {
163
+ return obj && typeof obj.next === fnString && typeof obj.throw === fnString;
164
+ }
165
+
166
+ function isObject(val) {
167
+ return val && val.constructor === Object;
168
+ }
169
+
170
+ /*
171
+ * Spawns a generator function which allows for Promises, Observable sequences, Arrays, Objects, Generators and functions.
172
+ * @param {Function} The spawning function.
173
+ * @returns {Function} a function which has a done continuation.
174
+ */
175
+ var observableSpawn = Rx.spawn = function (fn) {
176
+ var isGenFun = isGeneratorFunction(fn);
177
+
178
+ return function (done) {
179
+ var ctx = this,
180
+ gen = fan;
181
+
182
+ if (isGenFun) {
183
+ var args = slice.call(arguments),
184
+ len = args.length,
185
+ hasCallback = len && typeof args[len - 1] === fnString;
186
+
187
+ done = hasCallback ? args.pop() : error;
188
+ gen = fn.apply(this, args);
189
+ } else {
190
+ done = done || error;
191
+ }
192
+
193
+ next();
194
+
195
+ function exit(err, res) {
196
+ timeoutScheduler.schedule(done.bind(ctx, err, res));
197
+ }
198
+
199
+ function next(err, res) {
200
+ var ret;
201
+
202
+ // multiple args
203
+ if (arguments.length > 2) res = slice.call(arguments, 1);
204
+
205
+ if (err) {
206
+ try {
207
+ ret = gen.throw(err);
208
+ } catch (e) {
209
+ return exit(e);
210
+ }
211
+ }
212
+
213
+ if (!err) {
214
+ try {
215
+ ret = gen.next(res);
216
+ } catch (e) {
217
+ return exit(e);
218
+ }
219
+ }
220
+
221
+ if (ret.done) {
222
+ return exit(null, ret.value);
223
+ }
224
+
225
+ ret.value = toThunk(ret.value, ctx);
226
+
227
+ if (typeof ret.value === fnString) {
228
+ var called = false;
229
+ try {
230
+ ret.value.call(ctx, function(){
231
+ if (called) {
232
+ return;
233
+ }
234
+
235
+ called = true;
236
+ next.apply(ctx, arguments);
237
+ });
238
+ } catch (e) {
239
+ timeoutScheduler.schedule(function () {
240
+ if (called) {
241
+ return;
242
+ }
243
+
244
+ called = true;
245
+ next.call(ctx, e);
246
+ });
247
+ }
248
+ return;
249
+ }
250
+
251
+ // Not supported
252
+ next(new TypeError('Rx.spawn only supports a function, Promise, Observable, Object or Array.'));
253
+ }
254
+ }
255
+ };
256
+
257
+ /**
258
+ * Takes a function with a callback and turns it into a thunk.
259
+ * @param {Function} A function with a callback such as fs.readFile
260
+ * @returns {Function} A function, when executed will continue the state machine.
261
+ */
262
+ Rx.denodify = function (fn) {
263
+ return function (){
264
+ var args = slice.call(arguments),
265
+ results,
266
+ called,
267
+ callback;
268
+
269
+ args.push(function(){
270
+ results = arguments;
271
+
272
+ if (callback && !called) {
273
+ called = true;
274
+ cb.apply(this, results);
275
+ }
276
+ });
277
+
278
+ fn.apply(this, args);
279
+
280
+ return function (fn){
281
+ callback = fn;
282
+
283
+ if (results && !called) {
284
+ called = true;
285
+ fn.apply(this, results);
286
+ }
287
+ }
288
+ }
289
+ };
290
+
50
291
  /**
51
292
  * Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
52
293
  *
@@ -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.binding","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(b){var c=function(){this.cancelBubble=!0},d=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(b||(b=a.event),!b.target)switch(b.target=b.target||b.srcElement,"mouseover"==b.type&&(b.relatedTarget=b.fromElement),"mouseout"==b.type&&(b.relatedTarget=b.toElement),b.stopPropagation||(b.stopPropagation=c,b.preventDefault=d),b.type){case"keypress":var e="charCode"in b?b.charCode:b.keyCode;10==e?(e=0,b.keyCode=13):13==e||27==e?e=0:3==e&&(e=99),b.charCode=e,b.keyChar=b.charCode?String.fromCharCode(b.charCode):""}return b}function e(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),l(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var e=function(a){c(d(a))};return a.attachEvent("on"+b,e),l(function(){a.detachEvent("on"+b,e)})}return a["on"+b]=c,l(function(){a["on"+b]=null})}function f(a,b,c){var d=new m;if("[object NodeList]"===Object.prototype.toString.call(a))for(var g=0,h=a.length;h>g;g++)d.add(f(a.item(g),b,c));else a&&d.add(e(a,b,c));return d}var g=c.Observable,h=(g.prototype,g.fromPromise),i=g.throwException,j=c.AnonymousObservable,k=c.AsyncSubject,l=c.Disposable.create,m=c.CompositeDisposable,n=(c.Scheduler.immediate,c.Scheduler.timeout),o=c.helpers.isScheduler,p=Array.prototype.slice;g.start=function(a,b,c){return q(a,b,c)()};var q=g.toAsync=function(a,b,c){return o(c)||(c=n),function(){var d=arguments,e=new k;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};g.fromCallback=function(a,b,c){return function(){var d=p.call(arguments,0);return new j(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},g.fromNodeCallback=function(a,b,c){return function(){var d=p.call(arguments,0);return new j(function(e){function f(a){if(a)return void e.onError(a);var b=p.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},c.config.useNativeEvents=!1;var r=a.angular&&angular.element?angular.element:a.jQuery?a.jQuery:a.Zepto?a.Zepto:null,s=!!a.Ember&&"function"==typeof a.Ember.addListener,t=!!a.Backbone&&!!a.Backbone.Marionette;g.fromEvent=function(a,b,d){if(a.addListener)return u(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d);if(!c.config.useNativeEvents){if(t)return u(function(c){a.on(b,c)},function(c){a.off(b,c)},d);if(s)return u(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},d);if(r){var e=r(a);return u(function(a){e.on(b,a)},function(a){e.off(b,a)},d)}}return new j(function(c){return f(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return void c.onError(e)}c.onNext(b)})}).publish().refCount()};var u=g.fromEventPattern=function(a,b,c){return new j(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return l(function(){b&&b(e,f)})}).publish().refCount()};return g.startAsync=function(a){var b;try{b=a()}catch(c){return i(c)}return h(b)},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.binding","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 Array.isArray(a)?e.call(b,a):h(a)?y(a.call(b)):i(a)?y(a):g(a)?observableToThunk(a):isPromise(a)?f(a):typeof a===x?a:j(a)||Array.isArray(a)?e.call(b,a):a}function e(a){var b=this;return function(c){function e(a,e){if(!f)try{if(a=d(a,b),typeof a!==x)return i[e]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[e]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void u.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)e(a[g[j]],g[j])}}function f(a){return function(b){a.then(function(a){b(null,a)},b)}}function g(a){return a&&a.prototype.subscribe===x}function h(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function i(a){return a&&typeof a.next===x&&typeof a.throw===x}function j(a){return a&&a.constructor===Object}function k(b){var c=function(){this.cancelBubble=!0},d=function(){if(this.bubbledKeyCode=this.keyCode,this.ctrlKey)try{this.keyCode=0}catch(a){}this.defaultPrevented=!0,this.returnValue=!1,this.modified=!0};if(b||(b=a.event),!b.target)switch(b.target=b.target||b.srcElement,"mouseover"==b.type&&(b.relatedTarget=b.fromElement),"mouseout"==b.type&&(b.relatedTarget=b.toElement),b.stopPropagation||(b.stopPropagation=c,b.preventDefault=d),b.type){case"keypress":var e="charCode"in b?b.charCode:b.keyCode;10==e?(e=0,b.keyCode=13):13==e||27==e?e=0:3==e&&(e=99),b.charCode=e,b.keyChar=b.charCode?String.fromCharCode(b.charCode):""}return b}function l(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),s(function(){a.removeEventListener(b,c,!1)});if(a.attachEvent){var d=function(a){c(k(a))};return a.attachEvent("on"+b,d),s(function(){a.detachEvent("on"+b,d)})}return a["on"+b]=c,s(function(){a["on"+b]=null})}function m(a,b,c){var d=new t;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(m(a.item(e),b,c));else a&&d.add(l(a,b,c));return d}var n=c.Observable,o=(n.prototype,n.fromPromise),p=n.throwException,q=c.AnonymousObservable,r=c.AsyncSubject,s=c.Disposable.create,t=c.CompositeDisposable,u=(c.Scheduler.immediate,c.Scheduler.timeout),v=c.helpers.isScheduler,w=Array.prototype.slice,x="function",y=c.spawn=function(a){var b=h(a);return function(c){function e(a,b){u.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2&&(b=w.call(arguments,1)),a)try{c=h.throw(a)}catch(i){return e(i)}if(!a)try{c=h.next(b)}catch(i){return e(i)}if(c.done)return e(null,c.value);if(c.value=d(c.value,g),typeof c.value!==x)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var j=!1;try{c.value.call(g,function(){j||(j=!0,f.apply(g,arguments))})}catch(i){u.schedule(function(){j||(j=!0,f.call(g,i))})}}}var g=this,h=fan;if(b){var i=w.call(arguments),j=i.length,k=j&&typeof i[j-1]===x;c=k?i.pop():error,h=a.apply(this,i)}else c=c||error;f()}};c.denodify=function(a){return function(){var b,c,d,e=w.call(arguments);return e.push(function(){b=arguments,d&&!c&&(c=!0,cb.apply(this,b))}),a.apply(this,e),function(a){d=a,b&&!c&&(c=!0,a.apply(this,b))}}},n.start=function(a,b,c){return z(a,b,c)()};var z=n.toAsync=function(a,b,c){return v(c)||(c=u),function(){var d=arguments,e=new r;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};n.fromCallback=function(a,b,c){return function(){var d=w.call(arguments,0);return new q(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},n.fromNodeCallback=function(a,b,c){return function(){var d=w.call(arguments,0);return new q(function(e){function f(a){if(a)return void e.onError(a);var b=w.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},c.config.useNativeEvents=!1;var A=a.angular&&angular.element?angular.element:a.jQuery?a.jQuery:a.Zepto?a.Zepto:null,B=!!a.Ember&&"function"==typeof a.Ember.addListener,C=!!a.Backbone&&!!a.Backbone.Marionette;n.fromEvent=function(a,b,d){if(a.addListener)return D(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d);if(!c.config.useNativeEvents){if(C)return D(function(c){a.on(b,c)},function(c){a.off(b,c)},d);if(B)return D(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},d);if(A){var e=A(a);return D(function(a){e.on(b,a)},function(a){e.off(b,a)},d)}}return new q(function(c){return m(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return void c.onError(e)}c.onNext(b)})}).publish().refCount()};var D=n.fromEventPattern=function(a,b,c){return new q(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return s(function(){b&&b(e,f)})}).publish().refCount()};return n.startAsync=function(a){var b;try{b=a()}catch(c){return p(c)}return o(b)},c});
@@ -47,6 +47,247 @@
47
47
  isScheduler = Rx.helpers.isScheduler,
48
48
  slice = Array.prototype.slice;
49
49
 
50
+ var fnString = 'function';
51
+
52
+ function toThunk(obj, ctx) {
53
+ if (Array.isArray(obj)) {
54
+ return objectToThunk.call(ctx, obj);
55
+ }
56
+
57
+ if (isGeneratorFunction(obj)) {
58
+ return observableSpawn(obj.call(ctx));
59
+ }
60
+
61
+ if (isGenerator(obj)) {
62
+ return observableSpawn(obj);
63
+ }
64
+
65
+ if (isObservable(obj)) {
66
+ return observableToThunk(obj);
67
+ }
68
+
69
+ if (isPromise(obj)) {
70
+ return promiseToThunk(obj);
71
+ }
72
+
73
+ if (typeof obj === fnString) {
74
+ return obj;
75
+ }
76
+
77
+ if (isObject(obj) || Array.isArray(obj)) {
78
+ return objectToThunk.call(ctx, obj);
79
+ }
80
+
81
+ return obj;
82
+ }
83
+
84
+ function objectToThunk(obj) {
85
+ var ctx = this;
86
+
87
+ return function (done) {
88
+ var keys = Object.keys(obj),
89
+ pending = keys.length,
90
+ results = new obj.constructor(),
91
+ finished;
92
+
93
+ if (!pending) {
94
+ timeoutScheduler.schedule(function () { done(null, results); });
95
+ return;
96
+ }
97
+
98
+ for (var i = 0, len = keys.length; i < len; i++) {
99
+ run(obj[keys[i]], keys[i]);
100
+ }
101
+
102
+ function run(fn, key) {
103
+ if (finished) { return; }
104
+ try {
105
+ fn = toThunk(fn, ctx);
106
+
107
+ if (typeof fn !== fnString) {
108
+ results[key] = fn;
109
+ return --pending || done(null, results);
110
+ }
111
+
112
+ fn.call(ctx, function(err, res){
113
+ if (finished) { return; }
114
+
115
+ if (err) {
116
+ finished = true;
117
+ return done(err);
118
+ }
119
+
120
+ results[key] = res;
121
+ --pending || done(null, results);
122
+ });
123
+ } catch (e) {
124
+ finished = true;
125
+ done(e);
126
+ }
127
+ }
128
+ }
129
+ }
130
+
131
+ function observableToThink(observable) {
132
+ return function (fn) {
133
+ var value, hasValue = false;
134
+ observable.subscribe(
135
+ function (v) {
136
+ value = v;
137
+ hasValue = true;
138
+ },
139
+ fn,
140
+ function () {
141
+ hasValue && fn(null, value);
142
+ });
143
+ }
144
+ }
145
+
146
+ function promiseToThunk(promise) {
147
+ return function(fn){
148
+ promise.then(function(res) {
149
+ fn(null, res);
150
+ }, fn);
151
+ }
152
+ }
153
+
154
+ function isObservable(obj) {
155
+ return obj && obj.prototype.subscribe === fnString;
156
+ }
157
+
158
+ function isGeneratorFunction(obj) {
159
+ return obj && obj.constructor && obj.constructor.name === 'GeneratorFunction';
160
+ }
161
+
162
+ function isGenerator(obj) {
163
+ return obj && typeof obj.next === fnString && typeof obj.throw === fnString;
164
+ }
165
+
166
+ function isObject(val) {
167
+ return val && val.constructor === Object;
168
+ }
169
+
170
+ /*
171
+ * Spawns a generator function which allows for Promises, Observable sequences, Arrays, Objects, Generators and functions.
172
+ * @param {Function} The spawning function.
173
+ * @returns {Function} a function which has a done continuation.
174
+ */
175
+ var observableSpawn = Rx.spawn = function (fn) {
176
+ var isGenFun = isGeneratorFunction(fn);
177
+
178
+ return function (done) {
179
+ var ctx = this,
180
+ gen = fan;
181
+
182
+ if (isGenFun) {
183
+ var args = slice.call(arguments),
184
+ len = args.length,
185
+ hasCallback = len && typeof args[len - 1] === fnString;
186
+
187
+ done = hasCallback ? args.pop() : error;
188
+ gen = fn.apply(this, args);
189
+ } else {
190
+ done = done || error;
191
+ }
192
+
193
+ next();
194
+
195
+ function exit(err, res) {
196
+ timeoutScheduler.schedule(done.bind(ctx, err, res));
197
+ }
198
+
199
+ function next(err, res) {
200
+ var ret;
201
+
202
+ // multiple args
203
+ if (arguments.length > 2) res = slice.call(arguments, 1);
204
+
205
+ if (err) {
206
+ try {
207
+ ret = gen.throw(err);
208
+ } catch (e) {
209
+ return exit(e);
210
+ }
211
+ }
212
+
213
+ if (!err) {
214
+ try {
215
+ ret = gen.next(res);
216
+ } catch (e) {
217
+ return exit(e);
218
+ }
219
+ }
220
+
221
+ if (ret.done) {
222
+ return exit(null, ret.value);
223
+ }
224
+
225
+ ret.value = toThunk(ret.value, ctx);
226
+
227
+ if (typeof ret.value === fnString) {
228
+ var called = false;
229
+ try {
230
+ ret.value.call(ctx, function(){
231
+ if (called) {
232
+ return;
233
+ }
234
+
235
+ called = true;
236
+ next.apply(ctx, arguments);
237
+ });
238
+ } catch (e) {
239
+ timeoutScheduler.schedule(function () {
240
+ if (called) {
241
+ return;
242
+ }
243
+
244
+ called = true;
245
+ next.call(ctx, e);
246
+ });
247
+ }
248
+ return;
249
+ }
250
+
251
+ // Not supported
252
+ next(new TypeError('Rx.spawn only supports a function, Promise, Observable, Object or Array.'));
253
+ }
254
+ }
255
+ };
256
+
257
+ /**
258
+ * Takes a function with a callback and turns it into a thunk.
259
+ * @param {Function} A function with a callback such as fs.readFile
260
+ * @returns {Function} A function, when executed will continue the state machine.
261
+ */
262
+ Rx.denodify = function (fn) {
263
+ return function (){
264
+ var args = slice.call(arguments),
265
+ results,
266
+ called,
267
+ callback;
268
+
269
+ args.push(function(){
270
+ results = arguments;
271
+
272
+ if (callback && !called) {
273
+ called = true;
274
+ cb.apply(this, results);
275
+ }
276
+ });
277
+
278
+ fn.apply(this, args);
279
+
280
+ return function (fn){
281
+ callback = fn;
282
+
283
+ if (results && !called) {
284
+ called = true;
285
+ fn.apply(this, results);
286
+ }
287
+ }
288
+ }
289
+ };
290
+
50
291
  /**
51
292
  * Invokes the specified function asynchronously on the specified scheduler, surfacing the result through an observable sequence.
52
293
  *
@@ -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.binding","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,c){if(a.addEventListener)return a.addEventListener(b,c,!1),k(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function e(a,b,c){var f=new l;if("[object NodeList]"===Object.prototype.toString.call(a))for(var g=0,h=a.length;h>g;g++)f.add(e(a.item(g),b,c));else a&&f.add(d(a,b,c));return f}var f=c.Observable,g=(f.prototype,f.fromPromise),h=f.throwException,i=c.AnonymousObservable,j=c.AsyncSubject,k=c.Disposable.create,l=c.CompositeDisposable,m=(c.Scheduler.immediate,c.Scheduler.timeout),n=c.helpers.isScheduler,o=Array.prototype.slice;f.start=function(a,b,c){return p(a,b,c)()};var p=f.toAsync=function(a,b,c){return n(c)||(c=m),function(){var d=arguments,e=new j;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};f.fromCallback=function(a,b,c){return function(){var d=o.call(arguments,0);return new i(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},f.fromNodeCallback=function(a,b,c){return function(){var d=o.call(arguments,0);return new i(function(e){function f(a){if(a)return void e.onError(a);var b=o.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},c.config.useNativeEvents=!1;var q=a.angular&&angular.element?angular.element:a.jQuery?a.jQuery:a.Zepto?a.Zepto:null,r=!!a.Ember&&"function"==typeof a.Ember.addListener,s=!!a.Backbone&&!!a.Backbone.Marionette;f.fromEvent=function(a,b,d){if(a.addListener)return t(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d);if(!c.config.useNativeEvents){if(s)return t(function(c){a.on(b,c)},function(c){a.off(b,c)},d);if(r)return t(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},d);if(q){var f=q(a);return t(function(a){f.on(b,a)},function(a){f.off(b,a)},d)}}return new i(function(c){return e(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return void c.onError(e)}c.onNext(b)})}).publish().refCount()};var t=f.fromEventPattern=function(a,b,c){return new i(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return k(function(){b&&b(e,f)})}).publish().refCount()};return f.startAsync=function(a){var b;try{b=a()}catch(c){return h(c)}return g(b)},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.binding","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 Array.isArray(a)?e.call(b,a):h(a)?x(a.call(b)):i(a)?x(a):g(a)?observableToThunk(a):isPromise(a)?f(a):typeof a===w?a:j(a)||Array.isArray(a)?e.call(b,a):a}function e(a){var b=this;return function(c){function e(a,e){if(!f)try{if(a=d(a,b),typeof a!==w)return i[e]=a,--h||c(null,i);a.call(b,function(a,b){if(!f){if(a)return f=!0,c(a);i[e]=b,--h||c(null,i)}})}catch(g){f=!0,c(g)}}var f,g=Object.keys(a),h=g.length,i=new a.constructor;if(!h)return void t.schedule(function(){c(null,i)});for(var j=0,k=g.length;k>j;j++)e(a[g[j]],g[j])}}function f(a){return function(b){a.then(function(a){b(null,a)},b)}}function g(a){return a&&a.prototype.subscribe===w}function h(a){return a&&a.constructor&&"GeneratorFunction"===a.constructor.name}function i(a){return a&&typeof a.next===w&&typeof a.throw===w}function j(a){return a&&a.constructor===Object}function k(a,b,c){if(a.addEventListener)return a.addEventListener(b,c,!1),r(function(){a.removeEventListener(b,c,!1)});throw new Error("No listener found")}function l(a,b,c){var d=new s;if("[object NodeList]"===Object.prototype.toString.call(a))for(var e=0,f=a.length;f>e;e++)d.add(l(a.item(e),b,c));else a&&d.add(k(a,b,c));return d}var m=c.Observable,n=(m.prototype,m.fromPromise),o=m.throwException,p=c.AnonymousObservable,q=c.AsyncSubject,r=c.Disposable.create,s=c.CompositeDisposable,t=(c.Scheduler.immediate,c.Scheduler.timeout),u=c.helpers.isScheduler,v=Array.prototype.slice,w="function",x=c.spawn=function(a){var b=h(a);return function(c){function e(a,b){t.schedule(c.bind(g,a,b))}function f(a,b){var c;if(arguments.length>2&&(b=v.call(arguments,1)),a)try{c=h.throw(a)}catch(i){return e(i)}if(!a)try{c=h.next(b)}catch(i){return e(i)}if(c.done)return e(null,c.value);if(c.value=d(c.value,g),typeof c.value!==w)f(new TypeError("Rx.spawn only supports a function, Promise, Observable, Object or Array."));else{var j=!1;try{c.value.call(g,function(){j||(j=!0,f.apply(g,arguments))})}catch(i){t.schedule(function(){j||(j=!0,f.call(g,i))})}}}var g=this,h=fan;if(b){var i=v.call(arguments),j=i.length,k=j&&typeof i[j-1]===w;c=k?i.pop():error,h=a.apply(this,i)}else c=c||error;f()}};c.denodify=function(a){return function(){var b,c,d,e=v.call(arguments);return e.push(function(){b=arguments,d&&!c&&(c=!0,cb.apply(this,b))}),a.apply(this,e),function(a){d=a,b&&!c&&(c=!0,a.apply(this,b))}}},m.start=function(a,b,c){return y(a,b,c)()};var y=m.toAsync=function(a,b,c){return u(c)||(c=t),function(){var d=arguments,e=new q;return c.schedule(function(){var c;try{c=a.apply(b,d)}catch(f){return void e.onError(f)}e.onNext(c),e.onCompleted()}),e.asObservable()}};m.fromCallback=function(a,b,c){return function(){var d=v.call(arguments,0);return new p(function(e){function f(a){var b=a;if(c){try{b=c(arguments)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},m.fromNodeCallback=function(a,b,c){return function(){var d=v.call(arguments,0);return new p(function(e){function f(a){if(a)return void e.onError(a);var b=v.call(arguments,1);if(c){try{b=c(b)}catch(d){return void e.onError(d)}e.onNext(b)}else b.length<=1?e.onNext.apply(e,b):e.onNext(b);e.onCompleted()}d.push(f),a.apply(b,d)}).publishLast().refCount()}},c.config.useNativeEvents=!1;var z=a.angular&&angular.element?angular.element:a.jQuery?a.jQuery:a.Zepto?a.Zepto:null,A=!!a.Ember&&"function"==typeof a.Ember.addListener,B=!!a.Backbone&&!!a.Backbone.Marionette;m.fromEvent=function(a,b,d){if(a.addListener)return C(function(c){a.addListener(b,c)},function(c){a.removeListener(b,c)},d);if(!c.config.useNativeEvents){if(B)return C(function(c){a.on(b,c)},function(c){a.off(b,c)},d);if(A)return C(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},d);if(z){var e=z(a);return C(function(a){e.on(b,a)},function(a){e.off(b,a)},d)}}return new p(function(c){return l(a,b,function(a){var b=a;if(d)try{b=d(arguments)}catch(e){return void c.onError(e)}c.onNext(b)})}).publish().refCount()};var C=m.fromEventPattern=function(a,b,c){return new p(function(d){function e(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)}var f=a(e);return r(function(){b&&b(e,f)})}).publish().refCount()};return m.startAsync=function(a){var b;try{b=a()}catch(c){return o(c)}return n(b)},c});
@@ -168,6 +168,7 @@
168
168
  .subscribe(
169
169
  function (results) {
170
170
  if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
171
+ previousShouldFire = results.shouldFire;
171
172
  // change in shouldFire
172
173
  if (results.shouldFire) {
173
174
  while (q.length > 0) {
@@ -175,6 +176,7 @@
175
176
  }
176
177
  }
177
178
  } else {
179
+ previousShouldFire = results.shouldFire;
178
180
  // new data
179
181
  if (results.shouldFire) {
180
182
  observer.onNext(results.data);
@@ -182,9 +184,7 @@
182
184
  q.push(results.data);
183
185
  }
184
186
  }
185
- previousShouldFire = results.shouldFire;
186
-
187
- },
187
+ },
188
188
  function (err) {
189
189
  // Empty buffer before sending error
190
190
  while (q.length > 0) {
@@ -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(){if(this.isDisposed)throw new Error(r)}function f(a,b,c){return new i(function(d){function e(a,b){k[b]=a;var e;if(g[b]=!0,h||(h=g.every(q))){try{e=c.apply(null,k)}catch(f){return void d.onError(f)}d.onNext(e)}else i&&d.onCompleted()}var f=2,g=[!1,!1],h=!1,i=!1,k=new Array(f);return new j(a.subscribe(function(a){e(a,0)},d.onError.bind(d),function(){i=!0,d.onCompleted()}),b.subscribe(function(a){e(a,1)},d.onError.bind(d)))})}var g=c.Observable,h=g.prototype,i=c.AnonymousObservable,j=c.CompositeDisposable,k=c.Subject,l=c.Observer,m=c.Disposable.empty,n=c.Disposable.create,o=c.internals.inherits,p=c.internals.addProperties,q=(c.Scheduler.timeout,c.helpers.identity),r="Object has been disposed",s=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=m,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=m)});return new j(c,d,e)}function c(c,d){this.source=c,this.controller=new k,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return o(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(g);h.pausable=function(a){return new s(this,a)};var t=function(a){function b(a){var b,c=[],e=f(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(e){if(b!==d&&e.shouldFire!=b){if(e.shouldFire)for(;c.length>0;)a.onNext(c.shift())}else e.shouldFire?a.onNext(e.data):c.push(e.data);b=e.shouldFire},function(b){for(;c.length>0;)a.onNext(c.shift());a.onError(b)},function(){for(;c.length>0;)a.onNext(c.shift());a.onCompleted()});return e}function c(c,d){this.source=c,this.controller=new k,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return o(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(g);h.pausableBuffered=function(a){return new t(this,a)},h.controlled=function(a){return null==a&&(a=!0),new u(this,a)};var u=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new v(d),this.source=c.multicast(this.subject).refCount()}return o(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(g),v=c.ControlledSubject=function(a){function b(a){return this.subject.subscribe(a)}function c(c){null==c&&(c=!0),a.call(this,b),this.subject=new k,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=m,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=m}return o(c,a),p(c.prototype,l,{onCompleted:function(){e.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){e.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){e.call(this);var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=m):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=m),{numberOfItems:a,returnValue:!1}},request:function(a){e.call(this),this.disposeCurrentRequest();var b=this,c=this._processRequest(a);return a=c.numberOfItems,c.returnValue?m:(this.requestedCount=a,this.requestedDisposable=n(function(){b.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=m},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),c}(g);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(){if(this.isDisposed)throw new Error(r)}function f(a,b,c){return new i(function(d){function e(a,b){k[b]=a;var e;if(g[b]=!0,h||(h=g.every(q))){try{e=c.apply(null,k)}catch(f){return void d.onError(f)}d.onNext(e)}else i&&d.onCompleted()}var f=2,g=[!1,!1],h=!1,i=!1,k=new Array(f);return new j(a.subscribe(function(a){e(a,0)},d.onError.bind(d),function(){i=!0,d.onCompleted()}),b.subscribe(function(a){e(a,1)},d.onError.bind(d)))})}var g=c.Observable,h=g.prototype,i=c.AnonymousObservable,j=c.CompositeDisposable,k=c.Subject,l=c.Observer,m=c.Disposable.empty,n=c.Disposable.create,o=c.internals.inherits,p=c.internals.addProperties,q=(c.Scheduler.timeout,c.helpers.identity),r="Object has been disposed",s=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=m,e=this.pauser.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=m)});return new j(c,d,e)}function c(c,d){this.source=c,this.controller=new k,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return o(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(g);h.pausable=function(a){return new s(this,a)};var t=function(a){function b(a){var b,c=[],e=f(this.source,this.pauser.distinctUntilChanged().startWith(!1),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(e){if(b!==d&&e.shouldFire!=b){if(b=e.shouldFire,e.shouldFire)for(;c.length>0;)a.onNext(c.shift())}else b=e.shouldFire,e.shouldFire?a.onNext(e.data):c.push(e.data)},function(b){for(;c.length>0;)a.onNext(c.shift());a.onError(b)},function(){for(;c.length>0;)a.onNext(c.shift());a.onCompleted()});return e}function c(c,d){this.source=c,this.controller=new k,this.pauser=d&&d.subscribe?this.controller.merge(d):this.controller,a.call(this,b)}return o(c,a),c.prototype.pause=function(){this.controller.onNext(!1)},c.prototype.resume=function(){this.controller.onNext(!0)},c}(g);h.pausableBuffered=function(a){return new t(this,a)},h.controlled=function(a){return null==a&&(a=!0),new u(this,a)};var u=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new v(d),this.source=c.multicast(this.subject).refCount()}return o(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(g),v=c.ControlledSubject=function(a){function b(a){return this.subject.subscribe(a)}function c(c){null==c&&(c=!0),a.call(this,b),this.subject=new k,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=m,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=m}return o(c,a),p(c.prototype,l,{onCompleted:function(){e.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){e.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){e.call(this);var b=!1;0===this.requestedCount?this.enableQueue&&this.queue.push(a):(-1!==this.requestedCount&&0===this.requestedCount--&&this.disposeCurrentRequest(),b=!0),b&&this.subject.onNext(a)},_processRequest:function(a){if(this.enableQueue){for(;this.queue.length>=a&&a>0;)this.subject.onNext(this.queue.shift()),a--;return 0!==this.queue.length?{numberOfItems:a,returnValue:!0}:{numberOfItems:a,returnValue:!1}}return this.hasFailed?(this.subject.onError(this.error),this.controlledDisposable.dispose(),this.controlledDisposable=m):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=m),{numberOfItems:a,returnValue:!1}},request:function(a){e.call(this),this.disposeCurrentRequest();var b=this,c=this._processRequest(a);return a=c.numberOfItems,c.returnValue?m:(this.requestedCount=a,this.requestedDisposable=n(function(){b.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=m},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),c}(g);return c});