rxjs-rails 2.3.10 → 2.3.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.js +120 -70
- data/vendor/assets/javascripts/rx.aggregates.min.js +3 -1
- data/vendor/assets/javascripts/rx.all.compat.js +1810 -1849
- data/vendor/assets/javascripts/rx.all.compat.min.js +5 -3
- data/vendor/assets/javascripts/rx.all.js +1776 -1815
- data/vendor/assets/javascripts/rx.all.min.js +5 -3
- data/vendor/assets/javascripts/rx.async.compat.js +45 -45
- data/vendor/assets/javascripts/rx.async.compat.min.js +3 -1
- data/vendor/assets/javascripts/rx.async.js +39 -39
- data/vendor/assets/javascripts/rx.async.min.js +3 -1
- data/vendor/assets/javascripts/rx.backpressure.js +21 -19
- data/vendor/assets/javascripts/rx.backpressure.min.js +3 -1
- data/vendor/assets/javascripts/rx.binding.js +90 -90
- data/vendor/assets/javascripts/rx.binding.min.js +3 -1
- data/vendor/assets/javascripts/rx.coincidence.js +184 -179
- data/vendor/assets/javascripts/rx.coincidence.min.js +3 -1
- data/vendor/assets/javascripts/rx.compat.js +1019 -1001
- data/vendor/assets/javascripts/rx.compat.min.js +4 -2
- data/vendor/assets/javascripts/rx.experimental.js +65 -64
- data/vendor/assets/javascripts/rx.experimental.min.js +3 -1
- data/vendor/assets/javascripts/rx.joinpatterns.js +265 -363
- data/vendor/assets/javascripts/rx.joinpatterns.min.js +3 -1
- data/vendor/assets/javascripts/rx.js +969 -951
- data/vendor/assets/javascripts/rx.lite.compat.js +1014 -1182
- data/vendor/assets/javascripts/rx.lite.compat.min.js +4 -2
- data/vendor/assets/javascripts/rx.lite.extras.js +101 -109
- data/vendor/assets/javascripts/rx.lite.extras.min.js +3 -1
- data/vendor/assets/javascripts/rx.lite.js +1008 -1176
- data/vendor/assets/javascripts/rx.lite.min.js +4 -2
- data/vendor/assets/javascripts/rx.min.js +4 -2
- data/vendor/assets/javascripts/rx.testing.js +196 -196
- data/vendor/assets/javascripts/rx.testing.min.js +3 -1
- data/vendor/assets/javascripts/rx.time.js +162 -178
- data/vendor/assets/javascripts/rx.time.min.js +3 -1
- data/vendor/assets/javascripts/rx.virtualtime.js +30 -30
- data/vendor/assets/javascripts/rx.virtualtime.min.js +3 -1
- metadata +2 -6
- data/vendor/assets/javascripts/rx.core.compat.js +0 -2548
- data/vendor/assets/javascripts/rx.core.compat.min.js +0 -1
- data/vendor/assets/javascripts/rx.core.js +0 -2430
- data/vendor/assets/javascripts/rx.core.min.js +0 -1
@@ -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 = {
|
@@ -15,7 +15,7 @@
|
|
15
15
|
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
|
16
16
|
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
|
17
17
|
freeGlobal = objectTypes[typeof global] && global;
|
18
|
-
|
18
|
+
|
19
19
|
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
|
20
20
|
root = freeGlobal;
|
21
21
|
}
|
@@ -32,26 +32,26 @@
|
|
32
32
|
root.Rx = factory(root, {}, root.Rx);
|
33
33
|
}
|
34
34
|
}.call(this, function (root, exp, Rx, undefined) {
|
35
|
-
|
36
|
-
// Defaults
|
37
|
-
var Observer = Rx.Observer,
|
38
|
-
Observable = Rx.Observable,
|
39
|
-
Notification = Rx.Notification,
|
40
|
-
VirtualTimeScheduler = Rx.VirtualTimeScheduler,
|
41
|
-
Disposable = Rx.Disposable,
|
42
|
-
disposableEmpty = Disposable.empty,
|
43
|
-
disposableCreate = Disposable.create,
|
44
|
-
CompositeDisposable = Rx.CompositeDisposable,
|
45
|
-
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
|
46
|
-
slice = Array.prototype.slice,
|
47
|
-
inherits = Rx.internals.inherits,
|
48
|
-
defaultComparer = Rx.internals.isEqual;
|
49
|
-
|
50
|
-
function argsOrArray(args, idx) {
|
51
|
-
return args.length === 1 && Array.isArray(args[idx]) ?
|
52
|
-
args[idx] :
|
53
|
-
slice.call(args);
|
54
|
-
}
|
35
|
+
|
36
|
+
// Defaults
|
37
|
+
var Observer = Rx.Observer,
|
38
|
+
Observable = Rx.Observable,
|
39
|
+
Notification = Rx.Notification,
|
40
|
+
VirtualTimeScheduler = Rx.VirtualTimeScheduler,
|
41
|
+
Disposable = Rx.Disposable,
|
42
|
+
disposableEmpty = Disposable.empty,
|
43
|
+
disposableCreate = Disposable.create,
|
44
|
+
CompositeDisposable = Rx.CompositeDisposable,
|
45
|
+
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
|
46
|
+
slice = Array.prototype.slice,
|
47
|
+
inherits = Rx.internals.inherits,
|
48
|
+
defaultComparer = Rx.internals.isEqual;
|
49
|
+
|
50
|
+
function argsOrArray(args, idx) {
|
51
|
+
return args.length === 1 && Array.isArray(args[idx]) ?
|
52
|
+
args[idx] :
|
53
|
+
slice.call(args);
|
54
|
+
}
|
55
55
|
|
56
56
|
function OnNextPredicate(predicate) {
|
57
57
|
this.predicate = predicate;
|
@@ -85,10 +85,10 @@
|
|
85
85
|
|
86
86
|
/**
|
87
87
|
* Factory method for an OnNext notification record at a given time with a given value or a predicate function.
|
88
|
-
*
|
88
|
+
*
|
89
89
|
* 1 - ReactiveTest.onNext(200, 42);
|
90
90
|
* 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; });
|
91
|
-
*
|
91
|
+
*
|
92
92
|
* @param ticks Recorded virtual time the OnNext notification occurs.
|
93
93
|
* @param value Recorded value stored in the OnNext notification or a predicate.
|
94
94
|
* @return Recorded OnNext notification.
|
@@ -101,14 +101,14 @@
|
|
101
101
|
},
|
102
102
|
/**
|
103
103
|
* Factory method for an OnError notification record at a given time with a given error.
|
104
|
-
*
|
104
|
+
*
|
105
105
|
* 1 - ReactiveTest.onNext(200, new Error('error'));
|
106
106
|
* 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; });
|
107
|
-
*
|
107
|
+
*
|
108
108
|
* @param ticks Recorded virtual time the OnError notification occurs.
|
109
109
|
* @param exception Recorded exception stored in the OnError notification.
|
110
|
-
* @return Recorded OnError notification.
|
111
|
-
*/
|
110
|
+
* @return Recorded OnError notification.
|
111
|
+
*/
|
112
112
|
onError: function (ticks, exception) {
|
113
113
|
if (typeof exception === 'function') {
|
114
114
|
return new Recorded(ticks, new OnErrorPredicate(exception));
|
@@ -117,7 +117,7 @@
|
|
117
117
|
},
|
118
118
|
/**
|
119
119
|
* Factory method for an OnCompleted notification record at a given time.
|
120
|
-
*
|
120
|
+
*
|
121
121
|
* @param ticks Recorded virtual time the OnCompleted notification occurs.
|
122
122
|
* @return Recorded OnCompleted notification.
|
123
123
|
*/
|
@@ -126,7 +126,7 @@
|
|
126
126
|
},
|
127
127
|
/**
|
128
128
|
* Factory method for a subscription record based on a given subscription and disposal time.
|
129
|
-
*
|
129
|
+
*
|
130
130
|
* @param start Virtual time indicating when the subscription was created.
|
131
131
|
* @param end Virtual time indicating when the subscription was disposed.
|
132
132
|
* @return Subscription object.
|
@@ -154,8 +154,8 @@
|
|
154
154
|
* Checks whether the given recorded object is equal to the current instance.
|
155
155
|
*
|
156
156
|
* @param {Recorded} other Recorded object to check for equality.
|
157
|
-
* @returns {Boolean} true if both objects are equal; false otherwise.
|
158
|
-
*/
|
157
|
+
* @returns {Boolean} true if both objects are equal; false otherwise.
|
158
|
+
*/
|
159
159
|
Recorded.prototype.equals = function (other) {
|
160
160
|
return this.time === other.time && this.comparer(this.value, other.value);
|
161
161
|
};
|
@@ -163,15 +163,15 @@
|
|
163
163
|
/**
|
164
164
|
* Returns a string representation of the current Recorded value.
|
165
165
|
*
|
166
|
-
* @returns {String} String representation of the current Recorded value.
|
167
|
-
*/
|
166
|
+
* @returns {String} String representation of the current Recorded value.
|
167
|
+
*/
|
168
168
|
Recorded.prototype.toString = function () {
|
169
169
|
return this.value.toString() + '@' + this.time;
|
170
170
|
};
|
171
171
|
|
172
172
|
/**
|
173
173
|
* Creates a new subscription object with the given virtual subscription and unsubscription time.
|
174
|
-
*
|
174
|
+
*
|
175
175
|
* @constructor
|
176
176
|
* @param {Number} subscribe Virtual time at which the subscription occurred.
|
177
177
|
* @param {Number} unsubscribe Virtual time at which the unsubscription occurred.
|
@@ -198,150 +198,150 @@
|
|
198
198
|
return '(' + this.subscribe + ', ' + (this.unsubscribe === Number.MAX_VALUE ? 'Infinite' : this.unsubscribe) + ')';
|
199
199
|
};
|
200
200
|
|
201
|
-
/** @private */
|
202
|
-
var MockDisposable = Rx.MockDisposable = function (scheduler) {
|
203
|
-
this.scheduler = scheduler;
|
204
|
-
this.disposes = [];
|
205
|
-
this.disposes.push(this.scheduler.clock);
|
206
|
-
};
|
207
|
-
|
208
|
-
/*
|
209
|
-
* @memberOf MockDisposable#
|
210
|
-
* @prviate
|
211
|
-
*/
|
212
|
-
MockDisposable.prototype.dispose = function () {
|
213
|
-
this.disposes.push(this.scheduler.clock);
|
214
|
-
};
|
215
|
-
|
216
|
-
/** @private */
|
217
|
-
var MockObserver = (function (_super) {
|
218
|
-
inherits(MockObserver, _super);
|
219
|
-
|
220
|
-
/*
|
221
|
-
* @constructor
|
222
|
-
* @prviate
|
223
|
-
*/
|
224
|
-
function MockObserver(scheduler) {
|
225
|
-
_super.call(this);
|
226
|
-
this.scheduler = scheduler;
|
227
|
-
this.messages = [];
|
228
|
-
}
|
229
|
-
|
230
|
-
var MockObserverPrototype = MockObserver.prototype;
|
231
|
-
|
232
|
-
/*
|
233
|
-
* @memberOf MockObserverPrototype#
|
234
|
-
* @prviate
|
235
|
-
*/
|
236
|
-
MockObserverPrototype.onNext = function (value) {
|
237
|
-
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnNext(value)));
|
238
|
-
};
|
239
|
-
|
240
|
-
/*
|
241
|
-
* @memberOf MockObserverPrototype#
|
242
|
-
* @prviate
|
243
|
-
*/
|
244
|
-
MockObserverPrototype.onError = function (exception) {
|
245
|
-
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnError(exception)));
|
246
|
-
};
|
247
|
-
|
248
|
-
/*
|
249
|
-
* @memberOf MockObserverPrototype#
|
250
|
-
* @prviate
|
251
|
-
*/
|
252
|
-
MockObserverPrototype.onCompleted = function () {
|
253
|
-
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnCompleted()));
|
254
|
-
};
|
255
|
-
|
256
|
-
return MockObserver;
|
257
|
-
})(Observer);
|
258
|
-
|
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);
|
293
|
-
|
294
|
-
for (var j = 0, jLen = obs.length; j < jLen; j++) {
|
295
|
-
innerNotification.accept(obs[j]);
|
296
|
-
}
|
297
|
-
return disposableEmpty;
|
298
|
-
});
|
299
|
-
})(notification);
|
300
|
-
}
|
301
|
-
}
|
302
|
-
|
303
|
-
return HotObservable;
|
304
|
-
})(Observable);
|
305
|
-
|
306
|
-
/** @private */
|
307
|
-
var ColdObservable = (function (_super) {
|
308
|
-
|
309
|
-
function subscribe(observer) {
|
310
|
-
var message, notification, observable = this;
|
311
|
-
this.subscriptions.push(new Subscription(this.scheduler.clock));
|
312
|
-
var index = this.subscriptions.length - 1;
|
313
|
-
var d = new CompositeDisposable();
|
314
|
-
for (var i = 0, len = this.messages.length; i < len; i++) {
|
315
|
-
message = this.messages[i];
|
316
|
-
notification = message.value;
|
317
|
-
(function (innerNotification) {
|
318
|
-
d.add(observable.scheduler.scheduleRelativeWithState(null, message.time, function () {
|
319
|
-
innerNotification.accept(observer);
|
320
|
-
return disposableEmpty;
|
321
|
-
}));
|
322
|
-
})(notification);
|
323
|
-
}
|
324
|
-
return disposableCreate(function () {
|
325
|
-
observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);
|
326
|
-
d.dispose();
|
327
|
-
});
|
328
|
-
}
|
329
|
-
|
330
|
-
inherits(ColdObservable, _super);
|
331
|
-
|
332
|
-
/**
|
333
|
-
* @private
|
334
|
-
* @constructor
|
335
|
-
*/
|
336
|
-
function ColdObservable(scheduler, messages) {
|
337
|
-
_super.call(this, subscribe);
|
338
|
-
this.scheduler = scheduler;
|
339
|
-
this.messages = messages;
|
340
|
-
this.subscriptions = [];
|
341
|
-
}
|
342
|
-
|
343
|
-
return ColdObservable;
|
344
|
-
})(Observable);
|
201
|
+
/** @private */
|
202
|
+
var MockDisposable = Rx.MockDisposable = function (scheduler) {
|
203
|
+
this.scheduler = scheduler;
|
204
|
+
this.disposes = [];
|
205
|
+
this.disposes.push(this.scheduler.clock);
|
206
|
+
};
|
207
|
+
|
208
|
+
/*
|
209
|
+
* @memberOf MockDisposable#
|
210
|
+
* @prviate
|
211
|
+
*/
|
212
|
+
MockDisposable.prototype.dispose = function () {
|
213
|
+
this.disposes.push(this.scheduler.clock);
|
214
|
+
};
|
215
|
+
|
216
|
+
/** @private */
|
217
|
+
var MockObserver = (function (_super) {
|
218
|
+
inherits(MockObserver, _super);
|
219
|
+
|
220
|
+
/*
|
221
|
+
* @constructor
|
222
|
+
* @prviate
|
223
|
+
*/
|
224
|
+
function MockObserver(scheduler) {
|
225
|
+
_super.call(this);
|
226
|
+
this.scheduler = scheduler;
|
227
|
+
this.messages = [];
|
228
|
+
}
|
229
|
+
|
230
|
+
var MockObserverPrototype = MockObserver.prototype;
|
231
|
+
|
232
|
+
/*
|
233
|
+
* @memberOf MockObserverPrototype#
|
234
|
+
* @prviate
|
235
|
+
*/
|
236
|
+
MockObserverPrototype.onNext = function (value) {
|
237
|
+
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnNext(value)));
|
238
|
+
};
|
239
|
+
|
240
|
+
/*
|
241
|
+
* @memberOf MockObserverPrototype#
|
242
|
+
* @prviate
|
243
|
+
*/
|
244
|
+
MockObserverPrototype.onError = function (exception) {
|
245
|
+
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnError(exception)));
|
246
|
+
};
|
247
|
+
|
248
|
+
/*
|
249
|
+
* @memberOf MockObserverPrototype#
|
250
|
+
* @prviate
|
251
|
+
*/
|
252
|
+
MockObserverPrototype.onCompleted = function () {
|
253
|
+
this.messages.push(new Recorded(this.scheduler.clock, Notification.createOnCompleted()));
|
254
|
+
};
|
255
|
+
|
256
|
+
return MockObserver;
|
257
|
+
})(Observer);
|
258
|
+
|
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);
|
293
|
+
|
294
|
+
for (var j = 0, jLen = obs.length; j < jLen; j++) {
|
295
|
+
innerNotification.accept(obs[j]);
|
296
|
+
}
|
297
|
+
return disposableEmpty;
|
298
|
+
});
|
299
|
+
})(notification);
|
300
|
+
}
|
301
|
+
}
|
302
|
+
|
303
|
+
return HotObservable;
|
304
|
+
})(Observable);
|
305
|
+
|
306
|
+
/** @private */
|
307
|
+
var ColdObservable = (function (_super) {
|
308
|
+
|
309
|
+
function subscribe(observer) {
|
310
|
+
var message, notification, observable = this;
|
311
|
+
this.subscriptions.push(new Subscription(this.scheduler.clock));
|
312
|
+
var index = this.subscriptions.length - 1;
|
313
|
+
var d = new CompositeDisposable();
|
314
|
+
for (var i = 0, len = this.messages.length; i < len; i++) {
|
315
|
+
message = this.messages[i];
|
316
|
+
notification = message.value;
|
317
|
+
(function (innerNotification) {
|
318
|
+
d.add(observable.scheduler.scheduleRelativeWithState(null, message.time, function () {
|
319
|
+
innerNotification.accept(observer);
|
320
|
+
return disposableEmpty;
|
321
|
+
}));
|
322
|
+
})(notification);
|
323
|
+
}
|
324
|
+
return disposableCreate(function () {
|
325
|
+
observable.subscriptions[index] = new Subscription(observable.subscriptions[index].subscribe, observable.scheduler.clock);
|
326
|
+
d.dispose();
|
327
|
+
});
|
328
|
+
}
|
329
|
+
|
330
|
+
inherits(ColdObservable, _super);
|
331
|
+
|
332
|
+
/**
|
333
|
+
* @private
|
334
|
+
* @constructor
|
335
|
+
*/
|
336
|
+
function ColdObservable(scheduler, messages) {
|
337
|
+
_super.call(this, subscribe);
|
338
|
+
this.scheduler = scheduler;
|
339
|
+
this.messages = messages;
|
340
|
+
this.subscriptions = [];
|
341
|
+
}
|
342
|
+
|
343
|
+
return ColdObservable;
|
344
|
+
})(Observable);
|
345
345
|
|
346
346
|
/** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */
|
347
347
|
Rx.TestScheduler = (function (_super) {
|
@@ -358,7 +358,7 @@
|
|
358
358
|
|
359
359
|
/**
|
360
360
|
* Schedules an action to be executed at the specified virtual time.
|
361
|
-
*
|
361
|
+
*
|
362
362
|
* @param state State passed to the action to be executed.
|
363
363
|
* @param dueTime Absolute virtual time at which to execute the action.
|
364
364
|
* @param action Action to be executed.
|
@@ -372,7 +372,7 @@
|
|
372
372
|
};
|
373
373
|
/**
|
374
374
|
* Adds a relative virtual time to an absolute virtual time value.
|
375
|
-
*
|
375
|
+
*
|
376
376
|
* @param absolute Absolute virtual time value.
|
377
377
|
* @param relative Relative virtual time value to add.
|
378
378
|
* @return Resulting absolute virtual time sum value.
|
@@ -382,7 +382,7 @@
|
|
382
382
|
};
|
383
383
|
/**
|
384
384
|
* Converts the absolute virtual time value to a DateTimeOffset value.
|
385
|
-
*
|
385
|
+
*
|
386
386
|
* @param absolute Absolute virtual time value to convert.
|
387
387
|
* @return Corresponding DateTimeOffset value.
|
388
388
|
*/
|
@@ -391,7 +391,7 @@
|
|
391
391
|
};
|
392
392
|
/**
|
393
393
|
* Converts the TimeSpan value to a relative virtual time value.
|
394
|
-
*
|
394
|
+
*
|
395
395
|
* @param timeSpan TimeSpan value to convert.
|
396
396
|
* @return Corresponding relative virtual time value.
|
397
397
|
*/
|
@@ -400,13 +400,13 @@
|
|
400
400
|
};
|
401
401
|
/**
|
402
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
|
-
*
|
403
|
+
*
|
404
404
|
* @param create Factory method to create an observable sequence.
|
405
405
|
* @param created Virtual time at which to invoke the factory to create an observable sequence.
|
406
406
|
* @param subscribed Virtual time at which to subscribe to the created observable sequence.
|
407
407
|
* @param disposed Virtual time at which to dispose the subscription.
|
408
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
|
-
*/
|
409
|
+
*/
|
410
410
|
TestScheduler.prototype.startWithTiming = function (create, created, subscribed, disposed) {
|
411
411
|
var observer = this.createObserver(), source, subscription;
|
412
412
|
this.scheduleAbsoluteWithState(null, created, function () {
|
@@ -427,46 +427,46 @@
|
|
427
427
|
/**
|
428
428
|
* Starts the test scheduler and uses the specified virtual time to dispose the subscription to the sequence obtained through the factory function.
|
429
429
|
* Default virtual times are used for factory invocation and sequence subscription.
|
430
|
-
*
|
430
|
+
*
|
431
431
|
* @param create Factory method to create an observable sequence.
|
432
432
|
* @param disposed Virtual time at which to dispose the subscription.
|
433
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
|
-
*/
|
434
|
+
*/
|
435
435
|
TestScheduler.prototype.startWithDispose = function (create, disposed) {
|
436
436
|
return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, disposed);
|
437
437
|
};
|
438
438
|
/**
|
439
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
|
-
*
|
440
|
+
*
|
441
441
|
* @param create Factory method to create an observable sequence.
|
442
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
|
-
*/
|
443
|
+
*/
|
444
444
|
TestScheduler.prototype.startWithCreate = function (create) {
|
445
445
|
return this.startWithTiming(create, ReactiveTest.created, ReactiveTest.subscribed, ReactiveTest.disposed);
|
446
446
|
};
|
447
447
|
/**
|
448
448
|
* Creates a hot observable using the specified timestamped notification messages either as an array or arguments.
|
449
|
-
*
|
449
|
+
*
|
450
450
|
* @param messages Notifications to surface through the created sequence at their specified absolute virtual times.
|
451
451
|
* @return Hot observable sequence that can be used to assert the timing of subscriptions and notifications.
|
452
|
-
*/
|
452
|
+
*/
|
453
453
|
TestScheduler.prototype.createHotObservable = function () {
|
454
454
|
var messages = argsOrArray(arguments, 0);
|
455
455
|
return new HotObservable(this, messages);
|
456
456
|
};
|
457
457
|
/**
|
458
458
|
* Creates a cold observable using the specified timestamped notification messages either as an array or arguments.
|
459
|
-
*
|
459
|
+
*
|
460
460
|
* @param messages Notifications to surface through the created sequence at their specified virtual time offsets from the sequence subscription time.
|
461
461
|
* @return Cold observable sequence that can be used to assert the timing of subscriptions and notifications.
|
462
|
-
*/
|
462
|
+
*/
|
463
463
|
TestScheduler.prototype.createColdObservable = function () {
|
464
464
|
var messages = argsOrArray(arguments, 0);
|
465
465
|
return new ColdObservable(this, messages);
|
466
466
|
};
|
467
467
|
/**
|
468
468
|
* Creates an observer that records received notification messages and timestamps those.
|
469
|
-
*
|
469
|
+
*
|
470
470
|
* @return Observer that can be used to assert the timing of received notifications.
|
471
471
|
*/
|
472
472
|
TestScheduler.prototype.createObserver = function () {
|
@@ -476,5 +476,5 @@
|
|
476
476
|
return TestScheduler;
|
477
477
|
})(VirtualTimeScheduler);
|
478
478
|
|
479
|
-
return Rx;
|
480
|
-
}));
|
479
|
+
return Rx;
|
480
|
+
}));
|
@@ -1 +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});
|
3
|
+
//# sourceMappingURL=rx.testing.map
|