rxjs-rails 2.3.14 → 2.3.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rxjs/rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/rx.aggregates.js +325 -370
  4. data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
  5. data/vendor/assets/javascripts/rx.all.compat.js +1115 -930
  6. data/vendor/assets/javascripts/rx.all.compat.min.js +4 -3
  7. data/vendor/assets/javascripts/rx.all.js +1113 -928
  8. data/vendor/assets/javascripts/rx.all.min.js +3 -3
  9. data/vendor/assets/javascripts/rx.async.compat.js +16 -20
  10. data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
  11. data/vendor/assets/javascripts/rx.async.js +14 -18
  12. data/vendor/assets/javascripts/rx.async.min.js +1 -1
  13. data/vendor/assets/javascripts/rx.backpressure.js +26 -10
  14. data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
  15. data/vendor/assets/javascripts/rx.binding.js +2 -14
  16. data/vendor/assets/javascripts/rx.binding.min.js +1 -1
  17. data/vendor/assets/javascripts/rx.coincidence.js +13 -13
  18. data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
  19. data/vendor/assets/javascripts/rx.compat.js +586 -378
  20. data/vendor/assets/javascripts/rx.compat.min.js +2 -2
  21. data/vendor/assets/javascripts/rx.experimental.js +37 -29
  22. data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
  23. data/vendor/assets/javascripts/rx.js +586 -378
  24. data/vendor/assets/javascripts/rx.lite.compat.js +632 -394
  25. data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
  26. data/vendor/assets/javascripts/rx.lite.extras.js +29 -25
  27. data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
  28. data/vendor/assets/javascripts/rx.lite.js +630 -392
  29. data/vendor/assets/javascripts/rx.lite.min.js +2 -2
  30. data/vendor/assets/javascripts/rx.min.js +2 -2
  31. data/vendor/assets/javascripts/rx.sorting.js +72 -0
  32. data/vendor/assets/javascripts/rx.sorting.min.js +3 -0
  33. data/vendor/assets/javascripts/rx.testing.js +116 -83
  34. data/vendor/assets/javascripts/rx.testing.min.js +1 -1
  35. data/vendor/assets/javascripts/rx.time.js +127 -101
  36. data/vendor/assets/javascripts/rx.time.min.js +1 -1
  37. metadata +4 -2
@@ -211,48 +211,86 @@ var ReactiveTest = Rx.ReactiveTest = {
211
211
  this.disposes.push(this.scheduler.clock);
212
212
  };
213
213
 
214
- /** @private */
215
- var MockObserver = (function (_super) {
216
- inherits(MockObserver, _super);
217
-
218
- /*
219
- * @constructor
220
- * @prviate
221
- */
222
- function MockObserver(scheduler) {
223
- _super.call(this);
224
- this.scheduler = scheduler;
225
- this.messages = [];
214
+ var MockObserver = (function (__super__) {
215
+ inherits(MockObserver, __super__);
216
+
217
+ function MockObserver(scheduler) {
218
+ __super__.call(this);
219
+ this.scheduler = scheduler;
220
+ this.messages = [];
221
+ }
222
+
223
+ var MockObserverPrototype = MockObserver.prototype;
224
+
225
+ MockObserverPrototype.onNext = function (value) {
226
+ this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnNext(value)));
227
+ };
228
+
229
+ MockObserverPrototype.onError = function (exception) {
230
+ this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnError(exception)));
231
+ };
232
+
233
+ MockObserverPrototype.onCompleted = function () {
234
+ this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnCompleted()));
235
+ };
236
+
237
+ return MockObserver;
238
+ })(Observer);
239
+
240
+ function MockPromise(scheduler, messages) {
241
+ var self = this;
242
+ this.scheduler = scheduler;
243
+ this.messages = messages;
244
+ this.subscriptions = [];
245
+ this.observers = [];
246
+ for (var i = 0, len = this.messages.length; i < len; i++) {
247
+ var message = this.messages[i],
248
+ notification = message.value;
249
+ (function (innerNotification) {
250
+ scheduler.scheduleAbsoluteWithState(null, message.time, function () {
251
+ var obs = self.observers.slice(0);
252
+
253
+ for (var j = 0, jLen = obs.length; j < jLen; j++) {
254
+ innerNotification.accept(obs[j]);
255
+ }
256
+ return disposableEmpty;
257
+ });
258
+ })(notification);
259
+ }
260
+ }
261
+
262
+ MockPromise.prototype.then = function (onResolved, onRejected) {
263
+ var self = this;
264
+
265
+ this.subscriptions.push(new Subscription(this.scheduler.clock));
266
+ var index = this.subscriptions.length - 1;
267
+
268
+ var newPromise;
269
+
270
+ var observer = Rx.Observer.create(
271
+ function (x) {
272
+ var retValue = onResolved(x);
273
+ if (retValue && typeof retValue.then === 'function') {
274
+ newPromise = retValue;
275
+ } else {
276
+ var ticks = self.scheduler.clock;
277
+ newPromise = new MockPromise(self.scheduler, [Rx.ReactiveTest.onNext(ticks, undefined), Rx.ReactiveTest.onCompleted(ticks)]);
226
278
  }
279
+ var idx = self.observers.indexOf(observer);
280
+ self.observers.splice(idx, 1);
281
+ self.subscriptions[index] = new Subscription(self.subscriptions[index].subscribe, self.scheduler.clock);
282
+ },
283
+ function (err) {
284
+ onRejected(err);
285
+ var idx = self.observers.indexOf(observer);
286
+ self.observers.splice(idx, 1);
287
+ self.subscriptions[index] = new Subscription(self.subscriptions[index].subscribe, self.scheduler.clock);
288
+ }
289
+ );
290
+ this.observers.push(observer);
227
291
 
228
- var MockObserverPrototype = MockObserver.prototype;
229
-
230
- /*
231
- * @memberOf MockObserverPrototype#
232
- * @prviate
233
- */
234
- MockObserverPrototype.onNext = function (value) {
235
- this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnNext(value)));
236
- };
237
-
238
- /*
239
- * @memberOf MockObserverPrototype#
240
- * @prviate
241
- */
242
- MockObserverPrototype.onError = function (exception) {
243
- this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnError(exception)));
244
- };
245
-
246
- /*
247
- * @memberOf MockObserverPrototype#
248
- * @prviate
249
- */
250
- MockObserverPrototype.onCompleted = function () {
251
- this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnCompleted()));
252
- };
253
-
254
- return MockObserver;
255
- })(Observer);
292
+ return newPromise || new MockPromise(this.scheduler, this.messages);
293
+ };
256
294
 
257
295
  var HotObservable = (function (__super__) {
258
296
 
@@ -296,45 +334,40 @@ var ReactiveTest = Rx.ReactiveTest = {
296
334
  return HotObservable;
297
335
  })(Observable);
298
336
 
299
- /** @private */
300
- var ColdObservable = (function (_super) {
301
-
302
- function subscribe(observer) {
303
- var message, notification, observable = this;
304
- this.subscriptions.push(new Subscription(this.scheduler.clock));
305
- var index = this.subscriptions.length - 1;
306
- var d = new CompositeDisposable();
307
- for (var i = 0, len = this.messages.length; i < len; i++) {
308
- message = this.messages[i];
309
- notification = message.value;
310
- (function (innerNotification) {
311
- d.add(observable.scheduler.scheduleRelativeWithState(null, message.time, function () {
312
- innerNotification.accept(observer);
313
- return disposableEmpty;
314
- }));
315
- })(notification);
316
- }
317
- return disposableCreate(function () {
318
- observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);
319
- d.dispose();
320
- });
321
- }
337
+ var ColdObservable = (function (__super__) {
322
338
 
323
- inherits(ColdObservable, _super);
324
-
325
- /**
326
- * @private
327
- * @constructor
328
- */
329
- function ColdObservable(scheduler, messages) {
330
- _super.call(this, subscribe);
331
- this.scheduler = scheduler;
332
- this.messages = messages;
333
- this.subscriptions = [];
334
- }
339
+ function subscribe(observer) {
340
+ var message, notification, observable = this;
341
+ this.subscriptions.push(new Subscription(this.scheduler.clock));
342
+ var index = this.subscriptions.length - 1;
343
+ var d = new CompositeDisposable();
344
+ for (var i = 0, len = this.messages.length; i < len; i++) {
345
+ message = this.messages[i];
346
+ notification = message.value;
347
+ (function (innerNotification) {
348
+ d.add(observable.scheduler.scheduleRelativeWithState(null, message.time, function () {
349
+ innerNotification.accept(observer);
350
+ return disposableEmpty;
351
+ }));
352
+ })(notification);
353
+ }
354
+ return disposableCreate(function () {
355
+ observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);
356
+ d.dispose();
357
+ });
358
+ }
359
+
360
+ inherits(ColdObservable, __super__);
335
361
 
336
- return ColdObservable;
337
- })(Observable);
362
+ function ColdObservable(scheduler, messages) {
363
+ __super__.call(this, subscribe);
364
+ this.scheduler = scheduler;
365
+ this.messages = messages;
366
+ this.subscriptions = [];
367
+ }
368
+
369
+ return ColdObservable;
370
+ })(Observable);
338
371
 
339
372
  /** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */
340
373
  Rx.TestScheduler = (function (__super__) {
@@ -404,19 +437,19 @@ var ReactiveTest = Rx.ReactiveTest = {
404
437
  source = create();
405
438
  return disposableEmpty;
406
439
  });
407
-
440
+
408
441
  this.scheduleAbsoluteWithState(null, subscribed, function () {
409
442
  subscription = source.subscribe(observer);
410
443
  return disposableEmpty;
411
444
  });
412
-
445
+
413
446
  this.scheduleAbsoluteWithState(null, disposed, function () {
414
447
  subscription.dispose();
415
448
  return disposableEmpty;
416
449
  });
417
-
450
+
418
451
  this.start();
419
-
452
+
420
453
  return observer;
421
454
  };
422
455
 
@@ -463,7 +496,7 @@ var ReactiveTest = Rx.ReactiveTest = {
463
496
  };
464
497
 
465
498
  /**
466
- * Creates a resolved promise with the given value and ticks
499
+ * Creates a resolved promise with the given value and ticks
467
500
  * @param {Number} ticks The absolute time of the resolution.
468
501
  * @param {Any} value The value to yield at the given tick.
469
502
  * @returns {MockPromise} A mock Promise which fulfills with the given value.
@@ -473,7 +506,7 @@ var ReactiveTest = Rx.ReactiveTest = {
473
506
  };
474
507
 
475
508
  /**
476
- * Creates a rejected promise with the given reason and ticks
509
+ * Creates a rejected promise with the given reason and ticks
477
510
  * @param {Number} ticks The absolute time of the resolution.
478
511
  * @param {Any} reason The reason for rejection to yield at the given tick.
479
512
  * @returns {MockPromise} A mock Promise which rejects with the given reason.
@@ -1,3 +1,3 @@
1
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={"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.virtualtime","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.all")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:o.call(a)}function e(a){this.predicate=a}function f(a){this.predicate=a}var g=c.Observer,h=c.Observable,i=c.Notification,j=c.VirtualTimeScheduler,k=c.Disposable,l=k.empty,m=k.create,n=c.CompositeDisposable,o=(c.SingleAssignmentDisposable,Array.prototype.slice),p=c.internals.inherits,q=c.internals.isEqual;e.prototype.equals=function(a){return a===this?!0:null==a?!1:"N"!==a.kind?!1:this.predicate(a.value)},f.prototype.equals=function(a){return a===this?!0:null==a?!1:"E"!==a.kind?!1:this.predicate(a.exception)};var r=c.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(a,b){return"function"==typeof b?new s(a,new e(b)):new s(a,i.createOnNext(b))},onError:function(a,b){return"function"==typeof b?new s(a,new f(b)):new s(a,i.createOnError(b))},onCompleted:function(a){return new s(a,i.createOnCompleted())},subscribe:function(a,b){return new t(a,b)}},s=c.Recorded=function(a,b,c){this.time=a,this.value=b,this.comparer=c||q};s.prototype.equals=function(a){return this.time===a.time&&this.comparer(this.value,a.value)},s.prototype.toString=function(){return this.value.toString()+"@"+this.time};var t=c.Subscription=function(a,b){this.subscribe=a,this.unsubscribe=b||Number.MAX_VALUE};t.prototype.equals=function(a){return this.subscribe===a.subscribe&&this.unsubscribe===a.unsubscribe},t.prototype.toString=function(){return"("+this.subscribe+", "+(this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe)+")"};var u=c.MockDisposable=function(a){this.scheduler=a,this.disposes=[],this.disposes.push(this.scheduler.clock)};u.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var v=function(a){function b(b){a.call(this),this.scheduler=b,this.messages=[]}p(b,a);var c=b.prototype;return c.onNext=function(a){this.messages.push(new s(this.scheduler.clock,i.createOnNext(a)))},c.onError=function(a){this.messages.push(new s(this.scheduler.clock,i.createOnError(a)))},c.onCompleted=function(){this.messages.push(new s(this.scheduler.clock,i.createOnCompleted()))},b}(g),w=function(a){function b(a){var b=this;this.observers.push(a),this.subscriptions.push(new t(this.scheduler.clock));var c=this.subscriptions.length-1;return m(function(){var d=b.observers.indexOf(a);b.observers.splice(d,1),b.subscriptions[c]=new t(b.subscriptions[c].subscribe,b.scheduler.clock)})}function c(c,d){a.call(this,b);var e,f,g=this;this.scheduler=c,this.messages=d,this.subscriptions=[],this.observers=[];for(var h=0,i=this.messages.length;i>h;h++)e=this.messages[h],f=e.value,function(a){c.scheduleAbsoluteWithState(null,e.time,function(){for(var b=g.observers.slice(0),c=0,d=b.length;d>c;c++)a.accept(b[c]);return l})}(f)}return p(c,a),c}(h),x=function(a){function b(a){var b,c,d=this;this.subscriptions.push(new t(this.scheduler.clock));for(var e=this.subscriptions.length-1,f=new n,g=0,h=this.messages.length;h>g;g++)b=this.messages[g],c=b.value,function(c){f.add(d.scheduler.scheduleRelativeWithState(null,b.time,function(){return c.accept(a),l}))}(c);return m(function(){d.subscriptions[e]=new t(d.subscriptions[e].subscribe,d.scheduler.clock),f.dispose()})}function c(c,d){a.call(this,b),this.scheduler=c,this.messages=d,this.subscriptions=[]}return p(c,a),c}(h);return c.TestScheduler=function(a){function b(a,b){return a>b?1:b>a?-1:0}function e(){a.call(this,0,b)}return p(e,a),e.prototype.scheduleAbsoluteWithState=function(b,c,d){return c<=this.clock&&(c=this.clock+1),a.prototype.scheduleAbsoluteWithState.call(this,b,c,d)},e.prototype.add=function(a,b){return a+b},e.prototype.toDateTimeOffset=function(a){return new Date(a).getTime()},e.prototype.toRelative=function(a){return a},e.prototype.startWithTiming=function(a,b,c,d){var e,f,g=this.createObserver();return this.scheduleAbsoluteWithState(null,b,function(){return e=a(),l}),this.scheduleAbsoluteWithState(null,c,function(){return f=e.subscribe(g),l}),this.scheduleAbsoluteWithState(null,d,function(){return f.dispose(),l}),this.start(),g},e.prototype.startWithDispose=function(a,b){return this.startWithTiming(a,r.created,r.subscribed,b)},e.prototype.startWithCreate=function(a){return this.startWithTiming(a,r.created,r.subscribed,r.disposed)},e.prototype.createHotObservable=function(){var a=d(arguments,0);return new w(this,a)},e.prototype.createColdObservable=function(){var a=d(arguments,0);return new x(this,a)},e.prototype.createResolvedPromise=function(a,b){return new MockPromise(this,[c.ReactiveTest.onNext(a,b),c.ReactiveTest.onCompleted(a)])},e.prototype.createRejectedPromise=function(a,b){return new MockPromise(this,[c.ReactiveTest.onError(a,b)])},e.prototype.createObserver=function(){return new v(this)},e}(j),c});
2
+ (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.virtualtime","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.all")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c,d){function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:q.call(a)}function f(a){this.predicate=a}function g(a){this.predicate=a}function h(a,b){var c=this;this.scheduler=a,this.messages=b,this.subscriptions=[],this.observers=[];for(var d=0,e=this.messages.length;e>d;d++){var f=this.messages[d],g=f.value;!function(b){a.scheduleAbsoluteWithState(null,f.time,function(){for(var a=c.observers.slice(0),d=0,e=a.length;e>d;d++)b.accept(a[d]);return n})}(g)}}var i=c.Observer,j=c.Observable,k=c.Notification,l=c.VirtualTimeScheduler,m=c.Disposable,n=m.empty,o=m.create,p=c.CompositeDisposable,q=(c.SingleAssignmentDisposable,Array.prototype.slice),r=c.internals.inherits,s=c.internals.isEqual;f.prototype.equals=function(a){return a===this?!0:null==a?!1:"N"!==a.kind?!1:this.predicate(a.value)},g.prototype.equals=function(a){return a===this?!0:null==a?!1:"E"!==a.kind?!1:this.predicate(a.exception)};var t=c.ReactiveTest={created:100,subscribed:200,disposed:1e3,onNext:function(a,b){return"function"==typeof b?new u(a,new f(b)):new u(a,k.createOnNext(b))},onError:function(a,b){return"function"==typeof b?new u(a,new g(b)):new u(a,k.createOnError(b))},onCompleted:function(a){return new u(a,k.createOnCompleted())},subscribe:function(a,b){return new v(a,b)}},u=c.Recorded=function(a,b,c){this.time=a,this.value=b,this.comparer=c||s};u.prototype.equals=function(a){return this.time===a.time&&this.comparer(this.value,a.value)},u.prototype.toString=function(){return this.value.toString()+"@"+this.time};var v=c.Subscription=function(a,b){this.subscribe=a,this.unsubscribe=b||Number.MAX_VALUE};v.prototype.equals=function(a){return this.subscribe===a.subscribe&&this.unsubscribe===a.unsubscribe},v.prototype.toString=function(){return"("+this.subscribe+", "+(this.unsubscribe===Number.MAX_VALUE?"Infinite":this.unsubscribe)+")"};var w=c.MockDisposable=function(a){this.scheduler=a,this.disposes=[],this.disposes.push(this.scheduler.clock)};w.prototype.dispose=function(){this.disposes.push(this.scheduler.clock)};var x=function(a){function b(b){a.call(this),this.scheduler=b,this.messages=[]}r(b,a);var c=b.prototype;return c.onNext=function(a){this.messages.push(new u(this.scheduler.clock,k.createOnNext(a)))},c.onError=function(a){this.messages.push(new u(this.scheduler.clock,k.createOnError(a)))},c.onCompleted=function(){this.messages.push(new u(this.scheduler.clock,k.createOnCompleted()))},b}(i);h.prototype.then=function(a,b){var e=this;this.subscriptions.push(new v(this.scheduler.clock));var f,g=this.subscriptions.length-1,i=c.Observer.create(function(b){var j=a(b);if(j&&"function"==typeof j.then)f=j;else{var k=e.scheduler.clock;f=new h(e.scheduler,[c.ReactiveTest.onNext(k,d),c.ReactiveTest.onCompleted(k)])}var l=e.observers.indexOf(i);e.observers.splice(l,1),e.subscriptions[g]=new v(e.subscriptions[g].subscribe,e.scheduler.clock)},function(a){b(a);var c=e.observers.indexOf(i);e.observers.splice(c,1),e.subscriptions[g]=new v(e.subscriptions[g].subscribe,e.scheduler.clock)});return this.observers.push(i),f||new h(this.scheduler,this.messages)};var y=function(a){function b(a){var b=this;this.observers.push(a),this.subscriptions.push(new v(this.scheduler.clock));var c=this.subscriptions.length-1;return o(function(){var d=b.observers.indexOf(a);b.observers.splice(d,1),b.subscriptions[c]=new v(b.subscriptions[c].subscribe,b.scheduler.clock)})}function c(c,d){a.call(this,b);var e,f,g=this;this.scheduler=c,this.messages=d,this.subscriptions=[],this.observers=[];for(var h=0,i=this.messages.length;i>h;h++)e=this.messages[h],f=e.value,function(a){c.scheduleAbsoluteWithState(null,e.time,function(){for(var b=g.observers.slice(0),c=0,d=b.length;d>c;c++)a.accept(b[c]);return n})}(f)}return r(c,a),c}(j),z=function(a){function b(a){var b,c,d=this;this.subscriptions.push(new v(this.scheduler.clock));for(var e=this.subscriptions.length-1,f=new p,g=0,h=this.messages.length;h>g;g++)b=this.messages[g],c=b.value,function(c){f.add(d.scheduler.scheduleRelativeWithState(null,b.time,function(){return c.accept(a),n}))}(c);return o(function(){d.subscriptions[e]=new v(d.subscriptions[e].subscribe,d.scheduler.clock),f.dispose()})}function c(c,d){a.call(this,b),this.scheduler=c,this.messages=d,this.subscriptions=[]}return r(c,a),c}(j);return c.TestScheduler=function(a){function b(a,b){return a>b?1:b>a?-1:0}function d(){a.call(this,0,b)}return r(d,a),d.prototype.scheduleAbsoluteWithState=function(b,c,d){return c<=this.clock&&(c=this.clock+1),a.prototype.scheduleAbsoluteWithState.call(this,b,c,d)},d.prototype.add=function(a,b){return a+b},d.prototype.toDateTimeOffset=function(a){return new Date(a).getTime()},d.prototype.toRelative=function(a){return a},d.prototype.startWithTiming=function(a,b,c,d){var e,f,g=this.createObserver();return this.scheduleAbsoluteWithState(null,b,function(){return e=a(),n}),this.scheduleAbsoluteWithState(null,c,function(){return f=e.subscribe(g),n}),this.scheduleAbsoluteWithState(null,d,function(){return f.dispose(),n}),this.start(),g},d.prototype.startWithDispose=function(a,b){return this.startWithTiming(a,t.created,t.subscribed,b)},d.prototype.startWithCreate=function(a){return this.startWithTiming(a,t.created,t.subscribed,t.disposed)},d.prototype.createHotObservable=function(){var a=e(arguments,0);return new y(this,a)},d.prototype.createColdObservable=function(){var a=e(arguments,0);return new z(this,a)},d.prototype.createResolvedPromise=function(a,b){return new h(this,[c.ReactiveTest.onNext(a,b),c.ReactiveTest.onCompleted(a)])},d.prototype.createRejectedPromise=function(a,b){return new h(this,[c.ReactiveTest.onError(a,b)])},d.prototype.createObserver=function(){return new x(this)},d}(l),c});
3
3
  //# sourceMappingURL=rx.testing.map
@@ -53,7 +53,7 @@
53
53
  isPromise = helpers.isPromise,
54
54
  isScheduler = helpers.isScheduler,
55
55
  observableFromPromise = Observable.fromPromise,
56
- notDefined = helpers.notDefined;
56
+ deprecate = helpers.deprecate;
57
57
 
58
58
  function observableTimerDate(dueTime, scheduler) {
59
59
  return new AnonymousObservable(function (observer) {
@@ -204,7 +204,7 @@
204
204
  }
205
205
  });
206
206
  return new CompositeDisposable(subscription, cancelable);
207
- });
207
+ }, source);
208
208
  }
209
209
 
210
210
  function observableDelayDate(source, dueTime, scheduler) {
@@ -236,16 +236,11 @@
236
236
 
237
237
  /**
238
238
  * Ignores values from an observable sequence which are followed by another value before dueTime.
239
- *
240
- * @example
241
- * 1 - res = source.throttle(5000); // 5 seconds
242
- * 2 - res = source.throttle(5000, scheduler);
243
- *
244
- * @param {Number} dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds).
245
- * @param {Scheduler} [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
246
- * @returns {Observable} The throttled sequence.
239
+ * @param {Number} dueTime Duration of the debounce period for each value (specified as an integer denoting milliseconds).
240
+ * @param {Scheduler} [scheduler] Scheduler to run the debounce timers on. If not specified, the timeout scheduler is used.
241
+ * @returns {Observable} The debounced sequence.
247
242
  */
248
- observableProto.throttle = function (dueTime, scheduler) {
243
+ observableProto.debounce = observableProto.throttleWithTimeout = function (dueTime, scheduler) {
249
244
  isScheduler(scheduler) || (scheduler = timeoutScheduler);
250
245
  var source = this;
251
246
  return new AnonymousObservable(function (observer) {
@@ -277,7 +272,15 @@
277
272
  id++;
278
273
  });
279
274
  return new CompositeDisposable(subscription, cancelable);
280
- });
275
+ }, this);
276
+ };
277
+
278
+ /**
279
+ * @deprecated use #debounce or #throttleWithTimeout instead.
280
+ */
281
+ observableProto.throttle = function(dueTime, scheduler) {
282
+ deprecate('throttle', 'debounce or throttleWithTimeout');
283
+ return this.debounce(dueTime, scheduler);
281
284
  };
282
285
 
283
286
  /**
@@ -346,18 +349,18 @@
346
349
  groupDisposable.add(source.subscribe(
347
350
  function (x) {
348
351
  for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
349
- },
352
+ },
350
353
  function (e) {
351
354
  for (var i = 0, len = q.length; i < len; i++) { q[i].onError(e); }
352
355
  observer.onError(e);
353
- },
356
+ },
354
357
  function () {
355
358
  for (var i = 0, len = q.length; i < len; i++) { q[i].onCompleted(); }
356
359
  observer.onCompleted();
357
360
  }
358
361
  ));
359
362
  return refCountDisposable;
360
- });
363
+ }, source);
361
364
  };
362
365
 
363
366
  /**
@@ -391,7 +394,7 @@
391
394
  createTimer(newId);
392
395
  }));
393
396
  }
394
-
397
+
395
398
  observer.onNext(addRef(s, refCountDisposable));
396
399
  createTimer(0);
397
400
 
@@ -408,7 +411,7 @@
408
411
  observer.onNext(addRef(s, refCountDisposable));
409
412
  }
410
413
  newWindow && createTimer(newId);
411
- },
414
+ },
412
415
  function (e) {
413
416
  s.onError(e);
414
417
  observer.onError(e);
@@ -418,7 +421,7 @@
418
421
  }
419
422
  ));
420
423
  return refCountDisposable;
421
- });
424
+ }, source);
422
425
  };
423
426
 
424
427
  /**
@@ -496,7 +499,6 @@
496
499
  };
497
500
 
498
501
  function sampleObservable(source, sampler) {
499
-
500
502
  return new AnonymousObservable(function (observer) {
501
503
  var atEnd, value, hasValue;
502
504
 
@@ -517,7 +519,7 @@
517
519
  }),
518
520
  sampler.subscribe(sampleSubscribe, observer.onError.bind(observer), sampleSubscribe)
519
521
  );
520
- });
522
+ }, source);
521
523
  }
522
524
 
523
525
  /**
@@ -532,7 +534,7 @@
532
534
  * @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
533
535
  * @returns {Observable} Sampled observable sequence.
534
536
  */
535
- observableProto.sample = function (intervalOrSampler, scheduler) {
537
+ observableProto.sample = observableProto.throttleLatest = function (intervalOrSampler, scheduler) {
536
538
  isScheduler(scheduler) || (scheduler = timeoutScheduler);
537
539
  return typeof intervalOrSampler === 'number' ?
538
540
  sampleObservable(this, observableinterval(intervalOrSampler, scheduler)) :
@@ -593,7 +595,7 @@
593
595
  }
594
596
  }));
595
597
  return new CompositeDisposable(subscription, timer);
596
- });
598
+ }, source);
597
599
  };
598
600
 
599
601
  /**
@@ -719,68 +721,64 @@
719
721
  return this.delayWithSelector(observableTimer(dueTime, isScheduler(scheduler) ? scheduler : timeoutScheduler), observableEmpty);
720
722
  };
721
723
 
722
- /**
723
- * Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
724
- *
725
- * @example
726
- * 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
727
- * 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
728
- *
729
- * @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
730
- * @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
731
- * @returns {Observable} Time-shifted sequence.
732
- */
733
- observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) {
734
- var source = this, subDelay, selector;
735
- if (typeof subscriptionDelay === 'function') {
736
- selector = subscriptionDelay;
737
- } else {
738
- subDelay = subscriptionDelay;
739
- selector = delayDurationSelector;
740
- }
741
- return new AnonymousObservable(function (observer) {
742
- var delays = new CompositeDisposable(), atEnd = false, done = function () {
743
- if (atEnd && delays.length === 0) {
744
- observer.onCompleted();
745
- }
746
- }, subscription = new SerialDisposable(), start = function () {
747
- subscription.setDisposable(source.subscribe(function (x) {
748
- var delay;
749
- try {
750
- delay = selector(x);
751
- } catch (error) {
752
- observer.onError(error);
753
- return;
754
- }
755
- var d = new SingleAssignmentDisposable();
756
- delays.add(d);
757
- d.setDisposable(delay.subscribe(function () {
758
- observer.onNext(x);
759
- delays.remove(d);
760
- done();
761
- }, observer.onError.bind(observer), function () {
762
- observer.onNext(x);
763
- delays.remove(d);
764
- done();
765
- }));
766
- }, observer.onError.bind(observer), function () {
767
- atEnd = true;
768
- subscription.dispose();
769
- done();
770
- }));
771
- };
772
-
773
- if (!subDelay) {
774
- start();
775
- } else {
776
- subscription.setDisposable(subDelay.subscribe(function () {
777
- start();
778
- }, observer.onError.bind(observer), function () { start(); }));
779
- }
724
+ /**
725
+ * Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
726
+ *
727
+ * @example
728
+ * 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
729
+ * 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
730
+ *
731
+ * @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
732
+ * @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
733
+ * @returns {Observable} Time-shifted sequence.
734
+ */
735
+ observableProto.delayWithSelector = function (subscriptionDelay, delayDurationSelector) {
736
+ var source = this, subDelay, selector;
737
+ if (typeof subscriptionDelay === 'function') {
738
+ selector = subscriptionDelay;
739
+ } else {
740
+ subDelay = subscriptionDelay;
741
+ selector = delayDurationSelector;
742
+ }
743
+ return new AnonymousObservable(function (observer) {
744
+ var delays = new CompositeDisposable(), atEnd = false, done = function () {
745
+ if (atEnd && delays.length === 0) { observer.onCompleted(); }
746
+ }, subscription = new SerialDisposable(), start = function () {
747
+ subscription.setDisposable(source.subscribe(function (x) {
748
+ var delay;
749
+ try {
750
+ delay = selector(x);
751
+ } catch (error) {
752
+ observer.onError(error);
753
+ return;
754
+ }
755
+ var d = new SingleAssignmentDisposable();
756
+ delays.add(d);
757
+ d.setDisposable(delay.subscribe(function () {
758
+ observer.onNext(x);
759
+ delays.remove(d);
760
+ done();
761
+ }, observer.onError.bind(observer), function () {
762
+ observer.onNext(x);
763
+ delays.remove(d);
764
+ done();
765
+ }));
766
+ }, observer.onError.bind(observer), function () {
767
+ atEnd = true;
768
+ subscription.dispose();
769
+ done();
770
+ }));
771
+ };
780
772
 
781
- return new CompositeDisposable(subscription, delays);
782
- });
783
- };
773
+ if (!subDelay) {
774
+ start();
775
+ } else {
776
+ subscription.setDisposable(subDelay.subscribe(start, observer.onError.bind(observer), start));
777
+ }
778
+
779
+ return new CompositeDisposable(subscription, delays);
780
+ }, this);
781
+ };
784
782
 
785
783
  /**
786
784
  * Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
@@ -848,26 +846,22 @@
848
846
  observerWins() && observer.onCompleted();
849
847
  }));
850
848
  return new CompositeDisposable(subscription, timer);
851
- });
849
+ }, source);
852
850
  };
853
851
 
854
852
  /**
855
- * Ignores values from an observable sequence which are followed by another value within a computed throttle duration.
856
- *
857
- * @example
858
- * 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(x + x); });
859
- *
860
- * @param {Function} throttleDurationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
861
- * @returns {Observable} The throttled sequence.
853
+ * Ignores values from an observable sequence which are followed by another value within a computed throttle duration.
854
+ * @param {Function} durationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
855
+ * @returns {Observable} The debounced sequence.
862
856
  */
863
- observableProto.throttleWithSelector = function (throttleDurationSelector) {
857
+ observableProto.debounceWithSelector = function (durationSelector) {
864
858
  var source = this;
865
859
  return new AnonymousObservable(function (observer) {
866
860
  var value, hasValue = false, cancelable = new SerialDisposable(), id = 0;
867
861
  var subscription = source.subscribe(function (x) {
868
862
  var throttle;
869
863
  try {
870
- throttle = throttleDurationSelector(x);
864
+ throttle = durationSelector(x);
871
865
  } catch (e) {
872
866
  observer.onError(e);
873
867
  return;
@@ -902,7 +896,12 @@
902
896
  id++;
903
897
  });
904
898
  return new CompositeDisposable(subscription, cancelable);
905
- });
899
+ }, source);
900
+ };
901
+
902
+ observableProto.throttleWithSelector = function () {
903
+ deprecate('throttleWithSelector', 'debounceWithSelector');
904
+ return this.debounceWithSelector.apply(this, arguments);
906
905
  };
907
906
 
908
907
  /**
@@ -937,7 +936,7 @@
937
936
  }
938
937
  observer.onCompleted();
939
938
  });
940
- });
939
+ }, source);
941
940
  };
942
941
 
943
942
  /**
@@ -969,7 +968,7 @@
969
968
  }
970
969
  observer.onCompleted();
971
970
  });
972
- });
971
+ }, source);
973
972
  };
974
973
 
975
974
  /**
@@ -1002,7 +1001,7 @@
1002
1001
  observer.onNext(res);
1003
1002
  observer.onCompleted();
1004
1003
  });
1005
- });
1004
+ }, source);
1006
1005
  };
1007
1006
 
1008
1007
  /**
@@ -1023,7 +1022,7 @@
1023
1022
  isScheduler(scheduler) || (scheduler = timeoutScheduler);
1024
1023
  return new AnonymousObservable(function (observer) {
1025
1024
  return new CompositeDisposable(scheduler.scheduleWithRelative(duration, observer.onCompleted.bind(observer)), source.subscribe(observer));
1026
- });
1025
+ }, source);
1027
1026
  };
1028
1027
 
1029
1028
  /**
@@ -1050,7 +1049,7 @@
1050
1049
  return new CompositeDisposable(
1051
1050
  scheduler.scheduleWithRelative(duration, function () { open = true; }),
1052
1051
  source.subscribe(function (x) { open && observer.onNext(x); }, observer.onError.bind(observer), observer.onCompleted.bind(observer)));
1053
- });
1052
+ }, source);
1054
1053
  };
1055
1054
 
1056
1055
  /**
@@ -1078,7 +1077,7 @@
1078
1077
  function (x) { open && observer.onNext(x); },
1079
1078
  observer.onError.bind(observer),
1080
1079
  observer.onCompleted.bind(observer)));
1081
- });
1080
+ }, source);
1082
1081
  };
1083
1082
 
1084
1083
  /**
@@ -1096,7 +1095,34 @@
1096
1095
  return new CompositeDisposable(
1097
1096
  scheduler[schedulerMethod](endTime, observer.onCompleted.bind(observer)),
1098
1097
  source.subscribe(observer));
1099
- });
1098
+ }, source);
1099
+ };
1100
+
1101
+ /**
1102
+ * Returns an Observable that emits only the first item emitted by the source Observable during sequential time windows of a specified duration.
1103
+ * @param {Number} windowDuration time to wait before emitting another item after emitting the last item
1104
+ * @param {Scheduler} [scheduler] the Scheduler to use internally to manage the timers that handle timeout for each item. If not provided, defaults to Scheduler.timeout.
1105
+ * @returns {Observable} An Observable that performs the throttle operation.
1106
+ */
1107
+ observableProto.throttleFirst = function (windowDuration, scheduler) {
1108
+ isScheduler(scheduler) || (scheduler = timeoutScheduler);
1109
+ var duration = +windowDuration || 0;
1110
+ if (duration <= 0) { throw new RangeError('windowDuration cannot be less or equal zero.'); }
1111
+ var source = this;
1112
+ return new AnonymousObservable(function (observer) {
1113
+ var lastOnNext = 0;
1114
+ return source.subscribe(
1115
+ function (x) {
1116
+ var now = scheduler.now();
1117
+ if (lastOnNext === 0 || now - lastOnNext >= duration) {
1118
+ lastOnNext = now;
1119
+ observer.onNext(x);
1120
+ }
1121
+ },
1122
+ observer.onError.bind(observer),
1123
+ observer.onCompleted.bind(observer)
1124
+ );
1125
+ }, source);
1100
1126
  };
1101
1127
 
1102
1128
  return Rx;