rxjs-rails 2.3.11 → 2.3.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,88 +53,86 @@
53
53
  slice.call(args);
54
54
  }
55
55
 
56
- function OnNextPredicate(predicate) {
57
- this.predicate = predicate;
58
- };
59
-
60
- OnNextPredicate.prototype.equals = function (other) {
61
- if (other === this) { return true; }
62
- if (other == null) { return false; }
63
- if (other.kind !== 'N') { return false; }
64
- return this.predicate(other.value);
65
- };
66
-
67
- function OnErrorPredicate(predicate) {
68
- this.predicate = predicate;
69
- };
56
+ function OnNextPredicate(predicate) {
57
+ this.predicate = predicate;
58
+ };
59
+
60
+ OnNextPredicate.prototype.equals = function (other) {
61
+ if (other === this) { return true; }
62
+ if (other == null) { return false; }
63
+ if (other.kind !== 'N') { return false; }
64
+ return this.predicate(other.value);
65
+ };
66
+
67
+ function OnErrorPredicate(predicate) {
68
+ this.predicate = predicate;
69
+ };
70
+
71
+ OnErrorPredicate.prototype.equals = function (other) {
72
+ if (other === this) { return true; }
73
+ if (other == null) { return false; }
74
+ if (other.kind !== 'E') { return false; }
75
+ return this.predicate(other.exception);
76
+ };
77
+
78
+ var ReactiveTest = Rx.ReactiveTest = {
79
+ /** Default virtual time used for creation of observable sequences in unit tests. */
80
+ created: 100,
81
+ /** Default virtual time used to subscribe to observable sequences in unit tests. */
82
+ subscribed: 200,
83
+ /** Default virtual time used to dispose subscriptions in unit tests. */
84
+ disposed: 1000,
70
85
 
71
- OnErrorPredicate.prototype.equals = function (other) {
72
- if (other === this) { return true; }
73
- if (other == null) { return false; }
74
- if (other.kind !== 'E') { return false; }
75
- return this.predicate(other.exception);
76
- };
77
-
78
- var ReactiveTest = Rx.ReactiveTest = {
79
- /** Default virtual time used for creation of observable sequences in unit tests. */
80
- created: 100,
81
- /** Default virtual time used to subscribe to observable sequences in unit tests. */
82
- subscribed: 200,
83
- /** Default virtual time used to dispose subscriptions in unit tests. */
84
- disposed: 1000,
85
-
86
- /**
87
- * Factory method for an OnNext notification record at a given time with a given value or a predicate function.
88
- *
89
- * 1 - ReactiveTest.onNext(200, 42);
90
- * 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; });
91
- *
92
- * @param ticks Recorded virtual time the OnNext notification occurs.
93
- * @param value Recorded value stored in the OnNext notification or a predicate.
94
- * @return Recorded OnNext notification.
95
- */
96
- onNext: function (ticks, value) {
97
- if (typeof value === 'function') {
98
- return new Recorded(ticks, new OnNextPredicate(value));
99
- }
100
- return new Recorded(ticks, Notification.createOnNext(value));
101
- },
102
- /**
103
- * Factory method for an OnError notification record at a given time with a given error.
104
- *
105
- * 1 - ReactiveTest.onNext(200, new Error('error'));
106
- * 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; });
107
- *
108
- * @param ticks Recorded virtual time the OnError notification occurs.
109
- * @param exception Recorded exception stored in the OnError notification.
110
- * @return Recorded OnError notification.
111
- */
112
- onError: function (ticks, exception) {
113
- if (typeof exception === 'function') {
114
- return new Recorded(ticks, new OnErrorPredicate(exception));
115
- }
116
- return new Recorded(ticks, Notification.createOnError(exception));
117
- },
118
- /**
119
- * Factory method for an OnCompleted notification record at a given time.
120
- *
121
- * @param ticks Recorded virtual time the OnCompleted notification occurs.
122
- * @return Recorded OnCompleted notification.
123
- */
124
- onCompleted: function (ticks) {
125
- return new Recorded(ticks, Notification.createOnCompleted());
126
- },
127
- /**
128
- * Factory method for a subscription record based on a given subscription and disposal time.
129
- *
130
- * @param start Virtual time indicating when the subscription was created.
131
- * @param end Virtual time indicating when the subscription was disposed.
132
- * @return Subscription object.
133
- */
134
- subscribe: function (start, end) {
135
- return new Subscription(start, end);
136
- }
137
- };
86
+ /**
87
+ * Factory method for an OnNext notification record at a given time with a given value or a predicate function.
88
+ *
89
+ * 1 - ReactiveTest.onNext(200, 42);
90
+ * 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; });
91
+ *
92
+ * @param ticks Recorded virtual time the OnNext notification occurs.
93
+ * @param value Recorded value stored in the OnNext notification or a predicate.
94
+ * @return Recorded OnNext notification.
95
+ */
96
+ onNext: function (ticks, value) {
97
+ return typeof value === 'function' ?
98
+ new Recorded(ticks, new OnNextPredicate(value)) :
99
+ new Recorded(ticks, Notification.createOnNext(value));
100
+ },
101
+ /**
102
+ * Factory method for an OnError notification record at a given time with a given error.
103
+ *
104
+ * 1 - ReactiveTest.onNext(200, new Error('error'));
105
+ * 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; });
106
+ *
107
+ * @param ticks Recorded virtual time the OnError notification occurs.
108
+ * @param exception Recorded exception stored in the OnError notification.
109
+ * @return Recorded OnError notification.
110
+ */
111
+ onError: function (ticks, error) {
112
+ return typeof error === 'function' ?
113
+ new Recorded(ticks, new OnErrorPredicate(error)) :
114
+ new Recorded(ticks, Notification.createOnError(error));
115
+ },
116
+ /**
117
+ * Factory method for an OnCompleted notification record at a given time.
118
+ *
119
+ * @param ticks Recorded virtual time the OnCompleted notification occurs.
120
+ * @return Recorded OnCompleted notification.
121
+ */
122
+ onCompleted: function (ticks) {
123
+ return new Recorded(ticks, Notification.createOnCompleted());
124
+ },
125
+ /**
126
+ * Factory method for a subscription record based on a given subscription and disposal time.
127
+ *
128
+ * @param start Virtual time indicating when the subscription was created.
129
+ * @param end Virtual time indicating when the subscription was disposed.
130
+ * @return Subscription object.
131
+ */
132
+ subscribe: function (start, end) {
133
+ return new Subscription(start, end);
134
+ }
135
+ };
138
136
 
139
137
  /**
140
138
  * Creates a new object recording the production of the specified value at the given virtual time.
@@ -256,52 +254,47 @@
256
254
  return MockObserver;
257
255
  })(Observer);
258
256
 
259
- /** @private */
260
- var HotObservable = (function (_super) {
261
-
262
- function subscribe(observer) {
263
- var observable = this;
264
- this.observers.push(observer);
265
- this.subscriptions.push(new Subscription(this.scheduler.clock));
266
- var index = this.subscriptions.length - 1;
267
- return disposableCreate(function () {
268
- var idx = observable.observers.indexOf(observer);
269
- observable.observers.splice(idx, 1);
270
- observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);
271
- });
272
- }
273
-
274
- inherits(HotObservable, _super);
275
-
276
- /**
277
- * @private
278
- * @constructor
279
- */
280
- function HotObservable(scheduler, messages) {
281
- _super.call(this, subscribe);
282
- var message, notification, observable = this;
283
- this.scheduler = scheduler;
284
- this.messages = messages;
285
- this.subscriptions = [];
286
- this.observers = [];
287
- for (var i = 0, len = this.messages.length; i < len; i++) {
288
- message = this.messages[i];
289
- notification = message.value;
290
- (function (innerNotification) {
291
- scheduler.scheduleAbsoluteWithState(null, message.time, function () {
292
- var obs = observable.observers.slice(0);
257
+ var HotObservable = (function (__super__) {
258
+
259
+ function subscribe(observer) {
260
+ var observable = this;
261
+ this.observers.push(observer);
262
+ this.subscriptions.push(new Subscription(this.scheduler.clock));
263
+ var index = this.subscriptions.length - 1;
264
+ return disposableCreate(function () {
265
+ var idx = observable.observers.indexOf(observer);
266
+ observable.observers.splice(idx, 1);
267
+ observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);
268
+ });
269
+ }
293
270
 
294
- for (var j = 0, jLen = obs.length; j < jLen; j++) {
295
- innerNotification.accept(obs[j]);
296
- }
297
- return disposableEmpty;
298
- });
299
- })(notification);
271
+ inherits(HotObservable, __super__);
272
+
273
+ function HotObservable(scheduler, messages) {
274
+ __super__.call(this, subscribe);
275
+ var message, notification, observable = this;
276
+ this.scheduler = scheduler;
277
+ this.messages = messages;
278
+ this.subscriptions = [];
279
+ this.observers = [];
280
+ for (var i = 0, len = this.messages.length; i < len; i++) {
281
+ message = this.messages[i];
282
+ notification = message.value;
283
+ (function (innerNotification) {
284
+ scheduler.scheduleAbsoluteWithState(null, message.time, function () {
285
+ var obs = observable.observers.slice(0);
286
+
287
+ for (var j = 0, jLen = obs.length; j < jLen; j++) {
288
+ innerNotification.accept(obs[j]);
300
289
  }
301
- }
290
+ return disposableEmpty;
291
+ });
292
+ })(notification);
293
+ }
294
+ }
302
295
 
303
- return HotObservable;
304
- })(Observable);
296
+ return HotObservable;
297
+ })(Observable);
305
298
 
306
299
  /** @private */
307
300
  var ColdObservable = (function (_super) {
@@ -343,138 +336,162 @@
343
336
  return ColdObservable;
344
337
  })(Observable);
345
338
 
346
- /** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */
347
- Rx.TestScheduler = (function (_super) {
348
- inherits(TestScheduler, _super);
339
+ /** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */
340
+ Rx.TestScheduler = (function (__super__) {
341
+ inherits(TestScheduler, __super__);
349
342
 
350
- function baseComparer(x, y) {
351
- return x > y ? 1 : (x < y ? -1 : 0);
352
- }
343
+ function baseComparer(x, y) {
344
+ return x > y ? 1 : (x < y ? -1 : 0);
345
+ }
353
346
 
354
- /** @constructor */
355
- function TestScheduler() {
356
- _super.call(this, 0, baseComparer);
357
- }
347
+ function TestScheduler() {
348
+ __super__.call(this, 0, baseComparer);
349
+ }
358
350
 
359
- /**
360
- * Schedules an action to be executed at the specified virtual time.
361
- *
362
- * @param state State passed to the action to be executed.
363
- * @param dueTime Absolute virtual time at which to execute the action.
364
- * @param action Action to be executed.
365
- * @return Disposable object used to cancel the scheduled action (best effort).
366
- */
367
- TestScheduler.prototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
368
- if (dueTime <= this.clock) {
369
- dueTime = this.clock + 1;
370
- }
371
- return _super.prototype.scheduleAbsoluteWithState.call(this, state, dueTime, action);
372
- };
373
- /**
374
- * Adds a relative virtual time to an absolute virtual time value.
375
- *
376
- * @param absolute Absolute virtual time value.
377
- * @param relative Relative virtual time value to add.
378
- * @return Resulting absolute virtual time sum value.
379
- */
380
- TestScheduler.prototype.add = function (absolute, relative) {
381
- return absolute + relative;
382
- };
383
- /**
384
- * Converts the absolute virtual time value to a DateTimeOffset value.
385
- *
386
- * @param absolute Absolute virtual time value to convert.
387
- * @return Corresponding DateTimeOffset value.
388
- */
389
- TestScheduler.prototype.toDateTimeOffset = function (absolute) {
390
- return new Date(absolute).getTime();
391
- };
392
- /**
393
- * Converts the TimeSpan value to a relative virtual time value.
394
- *
395
- * @param timeSpan TimeSpan value to convert.
396
- * @return Corresponding relative virtual time value.
397
- */
398
- TestScheduler.prototype.toRelative = function (timeSpan) {
399
- return timeSpan;
400
- };
401
- /**
402
- * Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription.
403
- *
404
- * @param create Factory method to create an observable sequence.
405
- * @param created Virtual time at which to invoke the factory to create an observable sequence.
406
- * @param subscribed Virtual time at which to subscribe to the created observable sequence.
407
- * @param disposed Virtual time at which to dispose the subscription.
408
- * @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
409
- */
410
- TestScheduler.prototype.startWithTiming = function (create, created, subscribed, disposed) {
411
- var observer = this.createObserver(), source, subscription;
412
- this.scheduleAbsoluteWithState(null, created, function () {
413
- source = create();
414
- return disposableEmpty;
415
- });
416
- this.scheduleAbsoluteWithState(null, subscribed, function () {
417
- subscription = source.subscribe(observer);
418
- return disposableEmpty;
419
- });
420
- this.scheduleAbsoluteWithState(null, disposed, function () {
421
- subscription.dispose();
422
- return disposableEmpty;
423
- });
424
- this.start();
425
- return observer;
426
- };
427
- /**
428
- * Starts the test scheduler and uses the specified virtual time to dispose the subscription to the sequence obtained through the factory function.
429
- * Default virtual times are used for factory invocation and sequence subscription.
430
- *
431
- * @param create Factory method to create an observable sequence.
432
- * @param disposed Virtual time at which to dispose the subscription.
433
- * @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
434
- */
435
- TestScheduler.prototype.startWithDispose = function (create, disposed) {
436
- return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, disposed);
437
- };
438
- /**
439
- * Starts the test scheduler and uses default virtual times to invoke the factory function, to subscribe to the resulting sequence, and to dispose the subscription.
440
- *
441
- * @param create Factory method to create an observable sequence.
442
- * @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
443
- */
444
- TestScheduler.prototype.startWithCreate = function (create) {
445
- return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, ReactiveTest.disposed);
446
- };
447
- /**
448
- * Creates a hot observable using the specified timestamped notification messages either as an array or arguments.
449
- *
450
- * @param messages Notifications to surface through the created sequence at their specified absolute virtual times.
451
- * @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications.
452
- */
453
- TestScheduler.prototype.createHotObservable = function () {
454
- var messages = argsOrArray(arguments, 0);
455
- return new HotObservable(this, messages);
456
- };
457
- /**
458
- * Creates a cold observable using the specified timestamped notification messages either as an array or arguments.
459
- *
460
- * @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time.
461
- * @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications.
462
- */
463
- TestScheduler.prototype.createColdObservable = function () {
464
- var messages = argsOrArray(arguments, 0);
465
- return new ColdObservable(this, messages);
466
- };
467
- /**
468
- * Creates an observer that records received notification messages and timestamps those.
469
- *
470
- * @return Observer that can be used to assert the timing of received notifications.
471
- */
472
- TestScheduler.prototype.createObserver = function () {
473
- return new MockObserver(this);
474
- };
351
+ /**
352
+ * Schedules an action to be executed at the specified virtual time.
353
+ *
354
+ * @param state State passed to the action to be executed.
355
+ * @param dueTime Absolute virtual time at which to execute the action.
356
+ * @param action Action to be executed.
357
+ * @return Disposable object used to cancel the scheduled action (best effort).
358
+ */
359
+ TestScheduler.prototype.scheduleAbsoluteWithState = function (state, dueTime, action) {
360
+ dueTime <= this.clock && (dueTime = this.clock + 1);
361
+ return __super__.prototype.scheduleAbsoluteWithState.call(this, state, dueTime, action);
362
+ };
363
+ /**
364
+ * Adds a relative virtual time to an absolute virtual time value.
365
+ *
366
+ * @param absolute Absolute virtual time value.
367
+ * @param relative Relative virtual time value to add.
368
+ * @return Resulting absolute virtual time sum value.
369
+ */
370
+ TestScheduler.prototype.add = function (absolute, relative) {
371
+ return absolute + relative;
372
+ };
373
+ /**
374
+ * Converts the absolute virtual time value to a DateTimeOffset value.
375
+ *
376
+ * @param absolute Absolute virtual time value to convert.
377
+ * @return Corresponding DateTimeOffset value.
378
+ */
379
+ TestScheduler.prototype.toDateTimeOffset = function (absolute) {
380
+ return new Date(absolute).getTime();
381
+ };
382
+ /**
383
+ * Converts the TimeSpan value to a relative virtual time value.
384
+ *
385
+ * @param timeSpan TimeSpan value to convert.
386
+ * @return Corresponding relative virtual time value.
387
+ */
388
+ TestScheduler.prototype.toRelative = function (timeSpan) {
389
+ return timeSpan;
390
+ };
391
+ /**
392
+ * Starts the test scheduler and uses the specified virtual times to invoke the factory function, subscribe to the resulting sequence, and dispose the subscription.
393
+ *
394
+ * @param create Factory method to create an observable sequence.
395
+ * @param created Virtual time at which to invoke the factory to create an observable sequence.
396
+ * @param subscribed Virtual time at which to subscribe to the created observable sequence.
397
+ * @param disposed Virtual time at which to dispose the subscription.
398
+ * @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
399
+ */
400
+ TestScheduler.prototype.startWithTiming = function (create, created, subscribed, disposed) {
401
+ var observer = this.createObserver(), source, subscription;
402
+
403
+ this.scheduleAbsoluteWithState(null, created, function () {
404
+ source = create();
405
+ return disposableEmpty;
406
+ });
407
+
408
+ this.scheduleAbsoluteWithState(null, subscribed, function () {
409
+ subscription = source.subscribe(observer);
410
+ return disposableEmpty;
411
+ });
412
+
413
+ this.scheduleAbsoluteWithState(null, disposed, function () {
414
+ subscription.dispose();
415
+ return disposableEmpty;
416
+ });
417
+
418
+ this.start();
419
+
420
+ return observer;
421
+ };
422
+
423
+ /**
424
+ * Starts the test scheduler and uses the specified virtual time to dispose the subscription to the sequence obtained through the factory function.
425
+ * Default virtual times are used for factory invocation and sequence subscription.
426
+ *
427
+ * @param create Factory method to create an observable sequence.
428
+ * @param disposed Virtual time at which to dispose the subscription.
429
+ * @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
430
+ */
431
+ TestScheduler.prototype.startWithDispose = function (create, disposed) {
432
+ return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, disposed);
433
+ };
434
+
435
+ /**
436
+ * Starts the test scheduler and uses default virtual times to invoke the factory function, to subscribe to the resulting sequence, and to dispose the subscription.
437
+ *
438
+ * @param create Factory method to create an observable sequence.
439
+ * @return Observer with timestamped recordings of notification messages that were received during the virtual time window when the subscription to the source sequence was active.
440
+ */
441
+ TestScheduler.prototype.startWithCreate = function (create) {
442
+ return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, ReactiveTest.disposed);
443
+ };
444
+
445
+ /**
446
+ * Creates a hot observable using the specified timestamped notification messages either as an array or arguments.
447
+ * @param messages Notifications to surface through the created sequence at their specified absolute virtual times.
448
+ * @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications.
449
+ */
450
+ TestScheduler.prototype.createHotObservable = function () {
451
+ var messages = argsOrArray(arguments, 0);
452
+ return new HotObservable(this, messages);
453
+ };
454
+
455
+ /**
456
+ * Creates a cold observable using the specified timestamped notification messages either as an array or arguments.
457
+ * @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time.
458
+ * @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications.
459
+ */
460
+ TestScheduler.prototype.createColdObservable = function () {
461
+ var messages = argsOrArray(arguments, 0);
462
+ return new ColdObservable(this, messages);
463
+ };
464
+
465
+ /**
466
+ * Creates a resolved promise with the given value and ticks
467
+ * @param {Number} ticks The absolute time of the resolution.
468
+ * @param {Any} value The value to yield at the given tick.
469
+ * @returns {MockPromise} A mock Promise which fulfills with the given value.
470
+ */
471
+ TestScheduler.prototype.createResolvedPromise = function (ticks, value) {
472
+ return new MockPromise(this, [Rx.ReactiveTest.onNext(ticks, value), Rx.ReactiveTest.onCompleted(ticks)]);
473
+ };
474
+
475
+ /**
476
+ * Creates a rejected promise with the given reason and ticks
477
+ * @param {Number} ticks The absolute time of the resolution.
478
+ * @param {Any} reason The reason for rejection to yield at the given tick.
479
+ * @returns {MockPromise} A mock Promise which rejects with the given reason.
480
+ */
481
+ TestScheduler.prototype.createRejectedPromise = function (ticks, reason) {
482
+ return new MockPromise(this, [Rx.ReactiveTest.onError(ticks, reason)]);
483
+ };
484
+
485
+ /**
486
+ * Creates an observer that records received notification messages and timestamps those.
487
+ * @return Observer that can be used to assert the timing of received notifications.
488
+ */
489
+ TestScheduler.prototype.createObserver = function () {
490
+ return new MockObserver(this);
491
+ };
475
492
 
476
- return TestScheduler;
477
- })(VirtualTimeScheduler);
493
+ return TestScheduler;
494
+ })(VirtualTimeScheduler);
478
495
 
479
496
  return Rx;
480
497
  }));
@@ -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 c(){a.call(this,0,b)}return p(c,a),c.prototype.scheduleAbsoluteWithState=function(b,c,d){return c<=this.clock&&(c=this.clock+1),a.prototype.scheduleAbsoluteWithState.call(this,b,c,d)},c.prototype.add=function(a,b){return a+b},c.prototype.toDateTimeOffset=function(a){return new Date(a).getTime()},c.prototype.toRelative=function(a){return a},c.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},c.prototype.startWithDispose=function(a,b){return this.startWithTiming(a,r.created,r.subscribed,b)},c.prototype.startWithCreate=function(a){return this.startWithTiming(a,r.created,r.subscribed,r.disposed)},c.prototype.createHotObservable=function(){var a=d(arguments,0);return new w(this,a)},c.prototype.createColdObservable=function(){var a=d(arguments,0);return new x(this,a)},c.prototype.createObserver=function(){return new v(this)},c}(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){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});
3
3
  //# sourceMappingURL=rx.testing.map
@@ -547,7 +547,7 @@
547
547
  * @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
548
548
  */
549
549
  observableProto.timeout = function (dueTime, other, scheduler) {
550
- other || (other = observableThrow(new Error('Timeout')));
550
+ (other == null || typeof other === 'string') && (other = observableThrow(new Error(other || 'Timeout')));
551
551
  isScheduler(scheduler) || (scheduler = timeoutScheduler);
552
552
 
553
553
  var source = this, schedulerMethod = dueTime instanceof Date ?