rxjs-rails 2.3.0 → 2.3.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rxjs/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/rx.aggregates.js +115 -27
  4. data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
  5. data/vendor/assets/javascripts/rx.all.compat.js +2751 -2702
  6. data/vendor/assets/javascripts/rx.all.compat.min.js +3 -3
  7. data/vendor/assets/javascripts/rx.all.js +2605 -2589
  8. data/vendor/assets/javascripts/rx.all.min.js +3 -3
  9. data/vendor/assets/javascripts/rx.async.compat.js +41 -22
  10. data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
  11. data/vendor/assets/javascripts/rx.async.js +41 -22
  12. data/vendor/assets/javascripts/rx.async.min.js +1 -1
  13. data/vendor/assets/javascripts/rx.backpressure.js +41 -45
  14. data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
  15. data/vendor/assets/javascripts/rx.binding.js +81 -111
  16. data/vendor/assets/javascripts/rx.binding.min.js +1 -1
  17. data/vendor/assets/javascripts/rx.coincidence.js +567 -486
  18. data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
  19. data/vendor/assets/javascripts/rx.compat.js +1430 -1532
  20. data/vendor/assets/javascripts/rx.compat.min.js +2 -2
  21. data/vendor/assets/javascripts/rx.core.compat.js +76 -127
  22. data/vendor/assets/javascripts/rx.core.compat.min.js +1 -1
  23. data/vendor/assets/javascripts/rx.core.js +76 -127
  24. data/vendor/assets/javascripts/rx.core.min.js +1 -1
  25. data/vendor/assets/javascripts/rx.experimental.js +36 -36
  26. data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
  27. data/vendor/assets/javascripts/rx.joinpatterns.js +281 -281
  28. data/vendor/assets/javascripts/rx.js +1286 -1421
  29. data/vendor/assets/javascripts/rx.lite.compat.js +1443 -1749
  30. data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
  31. data/vendor/assets/javascripts/rx.lite.extras.js +133 -205
  32. data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
  33. data/vendor/assets/javascripts/rx.lite.js +1319 -1658
  34. data/vendor/assets/javascripts/rx.lite.min.js +2 -2
  35. data/vendor/assets/javascripts/rx.min.js +2 -2
  36. data/vendor/assets/javascripts/rx.testing.js +302 -322
  37. data/vendor/assets/javascripts/rx.testing.min.js +1 -1
  38. data/vendor/assets/javascripts/rx.time.js +90 -75
  39. data/vendor/assets/javascripts/rx.time.min.js +1 -1
  40. data/vendor/assets/javascripts/rx.virtualtime.js +264 -279
  41. data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -1
  42. metadata +10 -11
@@ -1,4 +1,4 @@
1
- // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
1
+ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
2
 
3
3
  ;(function (factory) {
4
4
  var objectTypes = {
@@ -140,7 +140,7 @@
140
140
 
141
141
  args.push(handler);
142
142
  func.apply(context, args);
143
- });
143
+ }).publishLast().refCount();
144
144
  };
145
145
  };
146
146
 
@@ -185,18 +185,11 @@
185
185
 
186
186
  args.push(handler);
187
187
  func.apply(context, args);
188
- });
188
+ }).publishLast().refCount();
189
189
  };
190
190
  };
191
191
 
192
192
  function createListener (element, name, handler) {
193
- // Node.js specific
194
- if (element.addListener) {
195
- element.addListener(name, handler);
196
- return disposableCreate(function () {
197
- element.removeListener(name, handler);
198
- });
199
- }
200
193
  if (element.addEventListener) {
201
194
  element.addEventListener(name, handler, false);
202
195
  return disposableCreate(function () {
@@ -210,7 +203,7 @@
210
203
  var disposables = new CompositeDisposable();
211
204
 
212
205
  // Asume NodeList
213
- if (typeof el.item === 'function' && typeof el.length === 'number') {
206
+ if (Object.prototype.toString.call(el) === '[object NodeList]') {
214
207
  for (var i = 0, len = el.length; i < len; i++) {
215
208
  disposables.add(createEventListener(el.item(i), eventName, handler));
216
209
  }
@@ -221,6 +214,11 @@
221
214
  return disposables;
222
215
  }
223
216
 
217
+ /**
218
+ * Configuration option to determine whether to use native events only
219
+ */
220
+ Rx.config.useNativeEvents = false;
221
+
224
222
  // Check for Angular/jQuery/Zepto support
225
223
  var jq =
226
224
  !!root.angular && !!angular.element ? angular.element :
@@ -229,6 +227,10 @@
229
227
 
230
228
  // Check for ember
231
229
  var ember = !!root.Ember && typeof root.Ember.addListener === 'function';
230
+
231
+ // Check for Backbone.Marionette. Note if using AMD add Marionette as a dependency of rxjs
232
+ // for proper loading order!
233
+ var marionette = !!root.Backbone && !!root.Backbone.Marionette;
232
234
 
233
235
  /**
234
236
  * Creates an observable sequence by adding an event listener to the matching DOMElement or each item in the NodeList.
@@ -242,18 +244,35 @@
242
244
  * @returns {Observable} An observable sequence of events from the specified element and the specified event.
243
245
  */
244
246
  Observable.fromEvent = function (element, eventName, selector) {
245
- if (ember) {
246
- return fromEventPattern(
247
- function (h) { Ember.addListener(element, eventName, h); },
248
- function (h) { Ember.removeListener(element, eventName, h); },
249
- selector);
250
- }
251
- if (jq) {
252
- var $elem = jq(element);
247
+ // Node.js specific
248
+ if (element.addListener) {
253
249
  return fromEventPattern(
254
- function (h) { $elem.on(eventName, h); },
255
- function (h) { $elem.off(eventName, h); },
250
+ function (h) { element.addListener(eventName, h); },
251
+ function (h) { element.removeListener(eventName, h); },
256
252
  selector);
253
+ }
254
+
255
+ // Use only if non-native events are allowed
256
+ if (!Rx.config.useNativeEvents) {
257
+ if (marionette) {
258
+ return fromEventPattern(
259
+ function (h) { element.on(eventName, h); },
260
+ function (h) { element.off(eventName, h); },
261
+ selector);
262
+ }
263
+ if (ember) {
264
+ return fromEventPattern(
265
+ function (h) { Ember.addListener(element, eventName, h); },
266
+ function (h) { Ember.removeListener(element, eventName, h); },
267
+ selector);
268
+ }
269
+ if (jq) {
270
+ var $elem = jq(element);
271
+ return fromEventPattern(
272
+ function (h) { $elem.on(eventName, h); },
273
+ function (h) { $elem.off(eventName, h); },
274
+ selector);
275
+ }
257
276
  }
258
277
  return new AnonymousObservable(function (observer) {
259
278
  return createEventListener(
@@ -322,5 +341,5 @@
322
341
  return observableFromPromise(promise);
323
342
  }
324
343
 
325
- return Rx;
344
+ return Rx;
326
345
  }));
@@ -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.addListener)return a.addListener(b,c),k(function(){a.removeListener(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("function"==typeof a.item&&"number"==typeof a.length)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)})}},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)})}};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;f.fromEvent=function(a,b,c){if(r)return s(function(c){Ember.addListener(a,b,c)},function(c){Ember.removeListener(a,b,c)},c);if(q){var d=q(a);return s(function(a){d.on(b,a)},function(a){d.off(b,a)},c)}return new i(function(d){return e(a,b,function(a){var b=a;if(c)try{b=c(arguments)}catch(e){return void d.onError(e)}d.onNext(b)})}).publish().refCount()};var s=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,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,4 +1,4 @@
1
- // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
1
+ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
2
 
3
3
  ;(function (factory) {
4
4
  var objectTypes = {
@@ -59,7 +59,7 @@
59
59
  subscription = conn.subscribe(observer),
60
60
  connection = disposableEmpty;
61
61
 
62
- var pausable = this.subject.distinctUntilChanged().subscribe(function (b) {
62
+ var pausable = this.pauser.distinctUntilChanged().subscribe(function (b) {
63
63
  if (b) {
64
64
  connection = conn.connect();
65
65
  } else {
@@ -71,27 +71,25 @@
71
71
  return new CompositeDisposable(subscription, connection, pausable);
72
72
  }
73
73
 
74
- function PausableObservable(source, subject) {
74
+ function PausableObservable(source, pauser) {
75
75
  this.source = source;
76
- this.subject = subject || new Subject();
77
- this.isPaused = true;
76
+ this.controller = new Subject();
77
+
78
+ if (pauser && pauser.subscribe) {
79
+ this.pauser = this.controller.merge(pauser);
80
+ } else {
81
+ this.pauser = this.controller;
82
+ }
83
+
78
84
  _super.call(this, subscribe);
79
85
  }
80
86
 
81
87
  PausableObservable.prototype.pause = function () {
82
- if (this.isPaused === true){
83
- return;
84
- }
85
- this.isPaused = true;
86
- this.subject.onNext(false);
88
+ this.controller.onNext(false);
87
89
  };
88
90
 
89
91
  PausableObservable.prototype.resume = function () {
90
- if (this.isPaused === false){
91
- return;
92
- }
93
- this.isPaused = false;
94
- this.subject.onNext(true);
92
+ this.controller.onNext(true);
95
93
  };
96
94
 
97
95
  return PausableObservable;
@@ -158,30 +156,33 @@
158
156
  inherits(PausableBufferedObservable, _super);
159
157
 
160
158
  function subscribe(observer) {
161
- var q = [], previous = true;
159
+ var q = [], previousShouldFire;
162
160
 
163
161
  var subscription =
164
162
  combineLatestSource(
165
163
  this.source,
166
- this.subject.distinctUntilChanged(),
164
+ this.pauser.distinctUntilChanged().startWith(false),
167
165
  function (data, shouldFire) {
168
166
  return { data: data, shouldFire: shouldFire };
169
167
  })
170
168
  .subscribe(
171
169
  function (results) {
172
- if (results.shouldFire && previous) {
173
- observer.onNext(results.data);
174
- }
175
- if (results.shouldFire && !previous) {
176
- while (q.length > 0) {
177
- observer.onNext(q.shift());
170
+ if (previousShouldFire !== undefined && results.shouldFire != previousShouldFire) {
171
+ // change in shouldFire
172
+ if (results.shouldFire) {
173
+ while (q.length > 0) {
174
+ observer.onNext(q.shift());
175
+ }
176
+ }
177
+ } else {
178
+ // new data
179
+ if (results.shouldFire) {
180
+ observer.onNext(results.data);
181
+ } else {
182
+ q.push(results.data);
178
183
  }
179
- previous = true;
180
- } else if (!results.shouldFire && !previous) {
181
- q.push(results.data);
182
- } else if (!results.shouldFire && previous) {
183
- previous = false;
184
184
  }
185
+ previousShouldFire = results.shouldFire;
185
186
 
186
187
  },
187
188
  function (err) {
@@ -199,33 +200,28 @@
199
200
  observer.onCompleted();
200
201
  }
201
202
  );
202
-
203
- this.subject.onNext(false);
204
-
205
203
  return subscription;
206
204
  }
207
205
 
208
- function PausableBufferedObservable(source, subject) {
206
+ function PausableBufferedObservable(source, pauser) {
209
207
  this.source = source;
210
- this.subject = subject || new Subject();
211
- this.isPaused = true;
208
+ this.controller = new Subject();
209
+
210
+ if (pauser && pauser.subscribe) {
211
+ this.pauser = this.controller.merge(pauser);
212
+ } else {
213
+ this.pauser = this.controller;
214
+ }
215
+
212
216
  _super.call(this, subscribe);
213
217
  }
214
218
 
215
219
  PausableBufferedObservable.prototype.pause = function () {
216
- if (this.isPaused === true){
217
- return;
218
- }
219
- this.isPaused = true;
220
- this.subject.onNext(false);
220
+ this.controller.onNext(false);
221
221
  };
222
222
 
223
223
  PausableBufferedObservable.prototype.resume = function () {
224
- if (this.isPaused === false){
225
- return;
226
- }
227
- this.isPaused = false;
228
- this.subject.onNext(true);
224
+ this.controller.onNext(true);
229
225
  };
230
226
 
231
227
  return PausableBufferedObservable;
@@ -406,5 +402,5 @@
406
402
 
407
403
  return ControlledSubject;
408
404
  }(Observable));
409
- return Rx;
405
+ return Rx;
410
406
  }));
@@ -1 +1 @@
1
- (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(){if(this.isDisposed)throw new Error(q)}function e(a,b,c){return new h(function(d){function e(a,b){k[b]=a;var e;if(g[b]=!0,h||(h=g.every(p))){try{e=c.apply(null,k)}catch(f){return void d.onError(f)}d.onNext(e)}else j&&d.onCompleted()}var f=2,g=[!1,!1],h=!1,j=!1,k=new Array(f);return new i(a.subscribe(function(a){e(a,0)},d.onError.bind(d),function(){j=!0,d.onCompleted()}),b.subscribe(function(a){e(a,1)},d.onError.bind(d)))})}var f=c.Observable,g=f.prototype,h=c.AnonymousObservable,i=c.CompositeDisposable,j=c.Subject,k=c.Observer,l=c.Disposable.empty,m=c.Disposable.create,n=c.internals.inherits,o=c.internals.addProperties,p=(c.Scheduler.timeout,c.helpers.identity),q="Object has been disposed",r=function(a){function b(a){var b=this.source.publish(),c=b.subscribe(a),d=l,e=this.subject.distinctUntilChanged().subscribe(function(a){a?d=b.connect():(d.dispose(),d=l)});return new i(c,d,e)}function c(c,d){this.source=c,this.subject=d||new j,this.isPaused=!0,a.call(this,b)}return n(c,a),c.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},c.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},c}(f);g.pausable=function(a){return new r(this,a)};var s=function(a){function b(a){var b=[],c=!0,d=e(this.source,this.subject.distinctUntilChanged(),function(a,b){return{data:a,shouldFire:b}}).subscribe(function(d){if(d.shouldFire&&c&&a.onNext(d.data),d.shouldFire&&!c){for(;b.length>0;)a.onNext(b.shift());c=!0}else d.shouldFire||c?!d.shouldFire&&c&&(c=!1):b.push(d.data)},function(c){for(;b.length>0;)a.onNext(b.shift());a.onError(c)},function(){for(;b.length>0;)a.onNext(b.shift());a.onCompleted()});return this.subject.onNext(!1),d}function c(c,d){this.source=c,this.subject=d||new j,this.isPaused=!0,a.call(this,b)}return n(c,a),c.prototype.pause=function(){this.isPaused!==!0&&(this.isPaused=!0,this.subject.onNext(!1))},c.prototype.resume=function(){this.isPaused!==!1&&(this.isPaused=!1,this.subject.onNext(!0))},c}(f);g.pausableBuffered=function(a){return new s(this,a)},g.controlled=function(a){return null==a&&(a=!0),new t(this,a)};var t=function(a){function b(a){return this.source.subscribe(a)}function c(c,d){a.call(this,b),this.subject=new u(d),this.source=c.multicast(this.subject).refCount()}return n(c,a),c.prototype.request=function(a){return null==a&&(a=-1),this.subject.request(a)},c}(f),u=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 j,this.enableQueue=c,this.queue=c?[]:null,this.requestedCount=0,this.requestedDisposable=l,this.error=null,this.hasFailed=!1,this.hasCompleted=!1,this.controlledDisposable=l}return n(c,a),o(c.prototype,k,{onCompleted:function(){d.call(this),this.hasCompleted=!0,this.enableQueue&&0!==this.queue.length||this.subject.onCompleted()},onError:function(a){d.call(this),this.hasFailed=!0,this.error=a,this.enableQueue&&0!==this.queue.length||this.subject.onError(a)},onNext:function(a){d.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=l):this.hasCompleted&&(this.subject.onCompleted(),this.controlledDisposable.dispose(),this.controlledDisposable=l),{numberOfItems:a,returnValue:!1}},request:function(a){d.call(this),this.disposeCurrentRequest();var b=this,c=this._processRequest(a);return a=c.numberOfItems,c.returnValue?l:(this.requestedCount=a,this.requestedDisposable=m(function(){b.requestedCount=0}),this.requestedDisposable)},disposeCurrentRequest:function(){this.requestedDisposable.dispose(),this.requestedDisposable=l},dispose:function(){this.isDisposed=!0,this.error=null,this.subject.dispose(),this.requestedDisposable.dispose()}}),c}(f);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(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,4 +1,4 @@
1
- // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
1
+ // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
2
2
 
3
3
  ;(function (factory) {
4
4
  var objectTypes = {
@@ -55,32 +55,32 @@
55
55
  }
56
56
  }
57
57
 
58
- /**
59
- * Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
60
- * subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
61
- * invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
62
- *
63
- * @example
64
- * 1 - res = source.multicast(observable);
65
- * 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
66
- *
67
- * @param {Function|Subject} subjectOrSubjectSelector
68
- * Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
69
- * Or:
70
- * Subject to push source elements into.
71
- *
72
- * @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
73
- * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
74
- */
75
- observableProto.multicast = function (subjectOrSubjectSelector, selector) {
76
- var source = this;
77
- return typeof subjectOrSubjectSelector === 'function' ?
78
- new AnonymousObservable(function (observer) {
79
- var connectable = source.multicast(subjectOrSubjectSelector());
80
- return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
81
- }) :
82
- new ConnectableObservable(source, subjectOrSubjectSelector);
83
- };
58
+ /**
59
+ * Multicasts the source sequence notifications through an instantiated subject into all uses of the sequence within a selector function. Each
60
+ * subscription to the resulting sequence causes a separate multicast invocation, exposing the sequence resulting from the selector function's
61
+ * invocation. For specializations with fixed subject types, see Publish, PublishLast, and Replay.
62
+ *
63
+ * @example
64
+ * 1 - res = source.multicast(observable);
65
+ * 2 - res = source.multicast(function () { return new Subject(); }, function (x) { return x; });
66
+ *
67
+ * @param {Function|Subject} subjectOrSubjectSelector
68
+ * Factory function to create an intermediate subject through which the source sequence's elements will be multicast to the selector function.
69
+ * Or:
70
+ * Subject to push source elements into.
71
+ *
72
+ * @param {Function} [selector] Optional selector function which can use the multicasted source sequence subject to the policies enforced by the created subject. Specified only if <paramref name="subjectOrSubjectSelector" is a factory function.
73
+ * @returns {Observable} An observable sequence that contains the elements of a sequence produced by multicasting the source sequence within a selector function.
74
+ */
75
+ observableProto.multicast = function (subjectOrSubjectSelector, selector) {
76
+ var source = this;
77
+ return typeof subjectOrSubjectSelector === 'function' ?
78
+ new AnonymousObservable(function (observer) {
79
+ var connectable = source.multicast(subjectOrSubjectSelector());
80
+ return new CompositeDisposable(selector(connectable).subscribe(observer), connectable.connect());
81
+ }) :
82
+ new ConnectableObservable(source, subjectOrSubjectSelector);
83
+ };
84
84
 
85
85
  /**
86
86
  * Returns an observable sequence that is the result of invoking the selector on a connectable observable sequence that shares a single subscription to the underlying sequence.
@@ -211,23 +211,23 @@
211
211
  return this.replay(null, bufferSize, window, scheduler).refCount();
212
212
  };
213
213
 
214
- /** @private */
215
- var InnerSubscription = function (subject, observer) {
216
- this.subject = subject;
217
- this.observer = observer;
218
- };
219
-
220
- /**
221
- * @private
222
- * @memberOf InnerSubscription
223
- */
224
- InnerSubscription.prototype.dispose = function () {
225
- if (!this.subject.isDisposed && this.observer !== null) {
226
- var idx = this.subject.observers.indexOf(this.observer);
227
- this.subject.observers.splice(idx, 1);
228
- this.observer = null;
229
- }
230
- };
214
+ /** @private */
215
+ var InnerSubscription = function (subject, observer) {
216
+ this.subject = subject;
217
+ this.observer = observer;
218
+ };
219
+
220
+ /**
221
+ * @private
222
+ * @memberOf InnerSubscription
223
+ */
224
+ InnerSubscription.prototype.dispose = function () {
225
+ if (!this.subject.isDisposed && this.observer !== null) {
226
+ var idx = this.subject.observers.indexOf(this.observer);
227
+ this.subject.observers.splice(idx, 1);
228
+ this.observer = null;
229
+ }
230
+ };
231
231
 
232
232
  /**
233
233
  * Represents a value that changes over time.
@@ -491,71 +491,41 @@
491
491
  return ReplaySubject;
492
492
  }(Observable));
493
493
 
494
- /** @private */
495
- var ConnectableObservable = Rx.ConnectableObservable = (function (_super) {
496
- inherits(ConnectableObservable, _super);
497
-
498
- /**
499
- * @constructor
500
- * @private
501
- */
502
- function ConnectableObservable(source, subject) {
503
- var state = {
504
- subject: subject,
505
- source: source.asObservable(),
506
- hasSubscription: false,
507
- subscription: null
508
- };
509
-
510
- this.connect = function () {
511
- if (!state.hasSubscription) {
512
- state.hasSubscription = true;
513
- state.subscription = new CompositeDisposable(state.source.subscribe(state.subject), disposableCreate(function () {
514
- state.hasSubscription = false;
515
- }));
516
- }
517
- return state.subscription;
518
- };
519
-
520
- function subscribe(observer) {
521
- return state.subject.subscribe(observer);
522
- }
523
-
524
- _super.call(this, subscribe);
525
- }
526
-
527
- /**
528
- * @private
529
- * @memberOf ConnectableObservable
530
- */
531
- ConnectableObservable.prototype.connect = function () { return this.connect(); };
532
-
533
- /**
534
- * @private
535
- * @memberOf ConnectableObservable
536
- */
537
- ConnectableObservable.prototype.refCount = function () {
538
- var connectableSubscription = null, count = 0, source = this;
539
- return new AnonymousObservable(function (observer) {
540
- var shouldConnect, subscription;
541
- count++;
542
- shouldConnect = count === 1;
543
- subscription = source.subscribe(observer);
544
- if (shouldConnect) {
545
- connectableSubscription = source.connect();
546
- }
547
- return disposableCreate(function () {
548
- subscription.dispose();
549
- count--;
550
- if (count === 0) {
551
- connectableSubscription.dispose();
552
- }
553
- });
554
- });
555
- };
556
-
557
- return ConnectableObservable;
558
- }(Observable));
559
-
560
- return Rx;
494
+ var ConnectableObservable = Rx.ConnectableObservable = (function (__super__) {
495
+ inherits(ConnectableObservable, __super__);
496
+
497
+ function ConnectableObservable(source, subject) {
498
+ var hasSubscription = false,
499
+ subscription,
500
+ sourceObservable = source.asObservable();
501
+
502
+ this.connect = function () {
503
+ if (!hasSubscription) {
504
+ hasSubscription = true;
505
+ subscription = new CompositeDisposable(sourceObservable.subscribe(subject), disposableCreate(function () {
506
+ hasSubscription = false;
507
+ }));
508
+ }
509
+ return subscription;
510
+ };
511
+
512
+ __super__.call(this, subject.subscribe.bind(subject));
513
+ }
514
+
515
+ ConnectableObservable.prototype.refCount = function () {
516
+ var connectableSubscription, count = 0, source = this;
517
+ return new AnonymousObservable(function (observer) {
518
+ var shouldConnect = ++count === 1,
519
+ subscription = source.subscribe(observer);
520
+ shouldConnect && (connectableSubscription = source.connect());
521
+ return function () {
522
+ subscription.dispose();
523
+ --count === 0 && connectableSubscription.dispose();
524
+ };
525
+ });
526
+ };
527
+
528
+ return ConnectableObservable;
529
+ }(Observable));
530
+ return Rx;
561
531
  }));
@@ -1 +1 @@
1
- (function(a){var b={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},c=b[typeof window]&&window||this,d=b[typeof exports]&&exports&&!exports.nodeType&&exports,e=b[typeof module]&&module&&!module.nodeType&&module,f=(e&&e.exports===d&&d,b[typeof global]&&global);!f||f.global!==f&&f.window!==f||(c=f),"function"==typeof define&&define.amd?define(["rx","exports"],function(b,d){return c.Rx=a(c,d,b),c.Rx}):"object"==typeof module&&module&&module.exports===d?module.exports=a(c,module.exports,require("./rx")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(){if(this.isDisposed)throw new Error(r)}var e=c.Observable,f=e.prototype,g=c.AnonymousObservable,h=c.Subject,i=c.AsyncSubject,j=c.Observer,k=c.internals.ScheduledObserver,l=c.Disposable.create,m=c.Disposable.empty,n=c.CompositeDisposable,o=c.Scheduler.currentThread,p=c.internals.inherits,q=c.internals.addProperties,r="Object has been disposed";f.multicast=function(a,b){var c=this;return"function"==typeof a?new g(function(d){var e=c.multicast(a());return new n(b(e).subscribe(d),e.connect())}):new v(c,a)},f.publish=function(a){return a?this.multicast(function(){return new h},a):this.multicast(new h)},f.share=function(){return this.publish(null).refCount()},f.publishLast=function(a){return a?this.multicast(function(){return new i},a):this.multicast(new i)},f.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new t(b)},a):this.multicast(new t(a))},f.shareValue=function(a){return this.publishValue(a).refCount()},f.replay=function(a,b,c,d){return a?this.multicast(function(){return new u(b,c,d)},a):this.multicast(new u(b,c,d))},f.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var s=function(a,b){this.subject=a,this.observer=b};s.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 t=c.BehaviorSubject=function(a){function b(a){if(d.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new s(this,a);var b=this.exception;return b?a.onError(b):a.onCompleted(),m}function c(c){a.call(this,b),this.value=c,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return p(c,a),q(c.prototype,j,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(d.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(d.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,e=b.length;e>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(d.call(this),!this.isStopped){this.value=a;for(var b=this.observers.slice(0),c=0,e=b.length;e>c;c++)b[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),c}(e),u=c.ReplaySubject=function(a){function b(a,b){this.subject=a,this.observer=b}function c(a){var c=new k(this.scheduler,a),e=new b(this,c);d.call(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var f=this.q.length,g=0,h=this.q.length;h>g;g++)c.onNext(this.q[g].value);return this.hasError?(f++,c.onError(this.error)):this.isStopped&&(f++,c.onCompleted()),c.ensureActive(f),e}function e(b,d,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==d?Number.MAX_VALUE:d,this.scheduler=e||o,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,c)}return b.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1)}},p(e,a),q(e.prototype,j,{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){var b;if(d.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var e=this.observers.slice(0),f=0,g=e.length;g>f;f++)b=e[f],b.onNext(a),b.ensureActive()}},onError:function(a){var b;if(d.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var e=this.observers.slice(0),f=0,g=e.length;g>f;f++)b=e[f],b.onError(a),b.ensureActive();this.observers=[]}},onCompleted:function(){var a;if(d.call(this),!this.isStopped){this.isStopped=!0;var b=this.scheduler.now();this._trim(b);for(var c=this.observers.slice(0),e=0,f=c.length;f>e;e++)a=c[e],a.onCompleted(),a.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(e),v=c.ConnectableObservable=function(a){function b(b,c){function d(a){return e.subject.subscribe(a)}var e={subject:c,source:b.asObservable(),hasSubscription:!1,subscription:null};this.connect=function(){return e.hasSubscription||(e.hasSubscription=!0,e.subscription=new n(e.source.subscribe(e.subject),l(function(){e.hasSubscription=!1}))),e.subscription},a.call(this,d)}return p(b,a),b.prototype.connect=function(){return this.connect()},b.prototype.refCount=function(){var a=null,b=0,c=this;return new g(function(d){var e,f;return b++,e=1===b,f=c.subscribe(d),e&&(a=c.connect()),l(function(){f.dispose(),b--,0===b&&a.dispose()})})},b}(e);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){function d(){if(this.isDisposed)throw new Error(r)}var e=c.Observable,f=e.prototype,g=c.AnonymousObservable,h=c.Subject,i=c.AsyncSubject,j=c.Observer,k=c.internals.ScheduledObserver,l=c.Disposable.create,m=c.Disposable.empty,n=c.CompositeDisposable,o=c.Scheduler.currentThread,p=c.internals.inherits,q=c.internals.addProperties,r="Object has been disposed";f.multicast=function(a,b){var c=this;return"function"==typeof a?new g(function(d){var e=c.multicast(a());return new n(b(e).subscribe(d),e.connect())}):new v(c,a)},f.publish=function(a){return a?this.multicast(function(){return new h},a):this.multicast(new h)},f.share=function(){return this.publish(null).refCount()},f.publishLast=function(a){return a?this.multicast(function(){return new i},a):this.multicast(new i)},f.publishValue=function(a,b){return 2===arguments.length?this.multicast(function(){return new t(b)},a):this.multicast(new t(a))},f.shareValue=function(a){return this.publishValue(a).refCount()},f.replay=function(a,b,c,d){return a?this.multicast(function(){return new u(b,c,d)},a):this.multicast(new u(b,c,d))},f.shareReplay=function(a,b,c){return this.replay(null,a,b,c).refCount()};var s=function(a,b){this.subject=a,this.observer=b};s.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 t=c.BehaviorSubject=function(a){function b(a){if(d.call(this),!this.isStopped)return this.observers.push(a),a.onNext(this.value),new s(this,a);var b=this.exception;return b?a.onError(b):a.onCompleted(),m}function c(c){a.call(this,b),this.value=c,this.observers=[],this.isDisposed=!1,this.isStopped=!1,this.exception=null}return p(c,a),q(c.prototype,j,{hasObservers:function(){return this.observers.length>0},onCompleted:function(){if(d.call(this),!this.isStopped){var a=this.observers.slice(0);this.isStopped=!0;for(var b=0,c=a.length;c>b;b++)a[b].onCompleted();this.observers=[]}},onError:function(a){if(d.call(this),!this.isStopped){var b=this.observers.slice(0);this.isStopped=!0,this.exception=a;for(var c=0,e=b.length;e>c;c++)b[c].onError(a);this.observers=[]}},onNext:function(a){if(d.call(this),!this.isStopped){this.value=a;for(var b=this.observers.slice(0),c=0,e=b.length;e>c;c++)b[c].onNext(a)}},dispose:function(){this.isDisposed=!0,this.observers=null,this.value=null,this.exception=null}}),c}(e),u=c.ReplaySubject=function(a){function b(a,b){this.subject=a,this.observer=b}function c(a){var c=new k(this.scheduler,a),e=new b(this,c);d.call(this),this._trim(this.scheduler.now()),this.observers.push(c);for(var f=this.q.length,g=0,h=this.q.length;h>g;g++)c.onNext(this.q[g].value);return this.hasError?(f++,c.onError(this.error)):this.isStopped&&(f++,c.onCompleted()),c.ensureActive(f),e}function e(b,d,e){this.bufferSize=null==b?Number.MAX_VALUE:b,this.windowSize=null==d?Number.MAX_VALUE:d,this.scheduler=e||o,this.q=[],this.observers=[],this.isStopped=!1,this.isDisposed=!1,this.hasError=!1,this.error=null,a.call(this,c)}return b.prototype.dispose=function(){if(this.observer.dispose(),!this.subject.isDisposed){var a=this.subject.observers.indexOf(this.observer);this.subject.observers.splice(a,1)}},p(e,a),q(e.prototype,j,{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){var b;if(d.call(this),!this.isStopped){var c=this.scheduler.now();this.q.push({interval:c,value:a}),this._trim(c);for(var e=this.observers.slice(0),f=0,g=e.length;g>f;f++)b=e[f],b.onNext(a),b.ensureActive()}},onError:function(a){var b;if(d.call(this),!this.isStopped){this.isStopped=!0,this.error=a,this.hasError=!0;var c=this.scheduler.now();this._trim(c);for(var e=this.observers.slice(0),f=0,g=e.length;g>f;f++)b=e[f],b.onError(a),b.ensureActive();this.observers=[]}},onCompleted:function(){var a;if(d.call(this),!this.isStopped){this.isStopped=!0;var b=this.scheduler.now();this._trim(b);for(var c=this.observers.slice(0),e=0,f=c.length;f>e;e++)a=c[e],a.onCompleted(),a.ensureActive();this.observers=[]}},dispose:function(){this.isDisposed=!0,this.observers=null}}),e}(e),v=c.ConnectableObservable=function(a){function b(b,c){var d,e=!1,f=b.asObservable();this.connect=function(){return e||(e=!0,d=new n(f.subscribe(c),l(function(){e=!1}))),d},a.call(this,c.subscribe.bind(c))}return p(b,a),b.prototype.refCount=function(){var a,b=0,c=this;return new g(function(d){var e=1===++b,f=c.subscribe(d);return e&&(a=c.connect()),function(){f.dispose(),0===--b&&a.dispose()}})},b}(e);return c});