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,16 +15,15 @@
|
|
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
|
}
|
22
22
|
|
23
23
|
// Because of build optimizers
|
24
24
|
if (typeof define === 'function' && define.amd) {
|
25
|
-
define(['rx'
|
26
|
-
|
27
|
-
return root.Rx;
|
25
|
+
define(['rx'], function (Rx, exports) {
|
26
|
+
return factory(root, exports, Rx);
|
28
27
|
});
|
29
28
|
} else if (typeof module === 'object' && module && module.exports === freeExports) {
|
30
29
|
module.exports = factory(root, module.exports, require('./rx'));
|
@@ -32,29 +31,29 @@
|
|
32
31
|
root.Rx = factory(root, {}, root.Rx);
|
33
32
|
}
|
34
33
|
}.call(this, function (root, exp, Rx, undefined) {
|
35
|
-
|
36
|
-
// Refernces
|
37
|
-
var Observable = Rx.Observable,
|
38
|
-
observableProto = Observable.prototype,
|
39
|
-
AnonymousObservable = Rx.AnonymousObservable,
|
40
|
-
observableDefer = Observable.defer,
|
41
|
-
observableEmpty = Observable.empty,
|
42
|
-
observableNever = Observable.never,
|
43
|
-
observableThrow = Observable.throwException,
|
44
|
-
observableFromArray = Observable.fromArray,
|
45
|
-
timeoutScheduler = Rx.Scheduler.timeout,
|
46
|
-
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
|
47
|
-
SerialDisposable = Rx.SerialDisposable,
|
48
|
-
CompositeDisposable = Rx.CompositeDisposable,
|
49
|
-
RefCountDisposable = Rx.RefCountDisposable,
|
50
|
-
Subject = Rx.Subject,
|
51
|
-
addRef = Rx.internals.addRef,
|
52
|
-
normalizeTime = Rx.Scheduler.normalize,
|
53
|
-
helpers = Rx.helpers,
|
54
|
-
isPromise = helpers.isPromise,
|
55
|
-
isScheduler = helpers.isScheduler,
|
56
|
-
observableFromPromise = Observable.fromPromise,
|
57
|
-
notDefined = helpers.notDefined;
|
34
|
+
|
35
|
+
// Refernces
|
36
|
+
var Observable = Rx.Observable,
|
37
|
+
observableProto = Observable.prototype,
|
38
|
+
AnonymousObservable = Rx.AnonymousObservable,
|
39
|
+
observableDefer = Observable.defer,
|
40
|
+
observableEmpty = Observable.empty,
|
41
|
+
observableNever = Observable.never,
|
42
|
+
observableThrow = Observable.throwException,
|
43
|
+
observableFromArray = Observable.fromArray,
|
44
|
+
timeoutScheduler = Rx.Scheduler.timeout,
|
45
|
+
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
|
46
|
+
SerialDisposable = Rx.SerialDisposable,
|
47
|
+
CompositeDisposable = Rx.CompositeDisposable,
|
48
|
+
RefCountDisposable = Rx.RefCountDisposable,
|
49
|
+
Subject = Rx.Subject,
|
50
|
+
addRef = Rx.internals.addRef,
|
51
|
+
normalizeTime = Rx.Scheduler.normalize,
|
52
|
+
helpers = Rx.helpers,
|
53
|
+
isPromise = helpers.isPromise,
|
54
|
+
isScheduler = helpers.isScheduler,
|
55
|
+
observableFromPromise = Observable.fromPromise,
|
56
|
+
notDefined = helpers.notDefined;
|
58
57
|
|
59
58
|
function observableTimerDate(dueTime, scheduler) {
|
60
59
|
return new AnonymousObservable(function (observer) {
|
@@ -104,11 +103,11 @@
|
|
104
103
|
|
105
104
|
/**
|
106
105
|
* Returns an observable sequence that produces a value after each period.
|
107
|
-
*
|
106
|
+
*
|
108
107
|
* @example
|
109
108
|
* 1 - res = Rx.Observable.interval(1000);
|
110
109
|
* 2 - res = Rx.Observable.interval(1000, Rx.Scheduler.timeout);
|
111
|
-
*
|
110
|
+
*
|
112
111
|
* @param {Number} period Period for producing the values in the resulting sequence (specified as an integer denoting milliseconds).
|
113
112
|
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, Rx.Scheduler.timeout is used.
|
114
113
|
* @returns {Observable} An observable sequence that produces a value after each period.
|
@@ -216,11 +215,11 @@
|
|
216
215
|
|
217
216
|
/**
|
218
217
|
* Time shifts the observable sequence by dueTime. The relative time intervals between the values are preserved.
|
219
|
-
*
|
218
|
+
*
|
220
219
|
* @example
|
221
220
|
* 1 - res = Rx.Observable.delay(new Date());
|
222
221
|
* 2 - res = Rx.Observable.delay(new Date(), Rx.Scheduler.timeout);
|
223
|
-
*
|
222
|
+
*
|
224
223
|
* 3 - res = Rx.Observable.delay(5000);
|
225
224
|
* 4 - res = Rx.Observable.delay(5000, 1000, Rx.Scheduler.timeout);
|
226
225
|
* @memberOf Observable#
|
@@ -237,11 +236,11 @@
|
|
237
236
|
|
238
237
|
/**
|
239
238
|
* Ignores values from an observable sequence which are followed by another value before dueTime.
|
240
|
-
*
|
239
|
+
*
|
241
240
|
* @example
|
242
241
|
* 1 - res = source.throttle(5000); // 5 seconds
|
243
|
-
* 2 - res = source.throttle(5000, scheduler);
|
244
|
-
*
|
242
|
+
* 2 - res = source.throttle(5000, scheduler);
|
243
|
+
*
|
245
244
|
* @param {Number} dueTime Duration of the throttle period for each value (specified as an integer denoting milliseconds).
|
246
245
|
* @param {Scheduler} [scheduler] Scheduler to run the throttle timers on. If not specified, the timeout scheduler is used.
|
247
246
|
* @returns {Observable} The throttled sequence.
|
@@ -260,16 +259,16 @@
|
|
260
259
|
d = new SingleAssignmentDisposable();
|
261
260
|
cancelable.setDisposable(d);
|
262
261
|
d.setDisposable(scheduler.scheduleWithRelative(dueTime, function () {
|
263
|
-
|
262
|
+
hasvalue && id === currentId && observer.onNext(value);
|
264
263
|
hasvalue = false;
|
265
264
|
}));
|
266
|
-
},
|
265
|
+
},
|
267
266
|
function (e) {
|
268
267
|
cancelable.dispose();
|
269
268
|
observer.onError(e);
|
270
269
|
hasvalue = false;
|
271
270
|
id++;
|
272
|
-
},
|
271
|
+
},
|
273
272
|
function () {
|
274
273
|
cancelable.dispose();
|
275
274
|
hasvalue && observer.onNext(value);
|
@@ -283,11 +282,6 @@
|
|
283
282
|
|
284
283
|
/**
|
285
284
|
* Projects each element of an observable sequence into zero or more windows which are produced based on timing information.
|
286
|
-
*
|
287
|
-
* @example
|
288
|
-
* 1 - res = xs.windowWithTime(1000, scheduler); // non-overlapping segments of 1 second
|
289
|
-
* 2 - res = xs.windowWithTime(1000, 500 , scheduler); // segments of 1 second with time shift 0.5 seconds
|
290
|
-
*
|
291
285
|
* @param {Number} timeSpan Length of each window (specified as an integer denoting milliseconds).
|
292
286
|
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive windows (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent windows.
|
293
287
|
* @param {Scheduler} [scheduler] Scheduler to run windowing timers on. If not specified, the timeout scheduler is used.
|
@@ -295,9 +289,7 @@
|
|
295
289
|
*/
|
296
290
|
observableProto.windowWithTime = function (timeSpan, timeShiftOrScheduler, scheduler) {
|
297
291
|
var source = this, timeShift;
|
298
|
-
|
299
|
-
timeShift = timeSpan;
|
300
|
-
}
|
292
|
+
timeShiftOrScheduler == null && (timeShift = timeSpan);
|
301
293
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
302
294
|
if (typeof timeShiftOrScheduler === 'number') {
|
303
295
|
timeShift = timeShiftOrScheduler;
|
@@ -307,19 +299,19 @@
|
|
307
299
|
}
|
308
300
|
return new AnonymousObservable(function (observer) {
|
309
301
|
var groupDisposable,
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
302
|
+
nextShift = timeShift,
|
303
|
+
nextSpan = timeSpan,
|
304
|
+
q = [],
|
305
|
+
refCountDisposable,
|
306
|
+
timerD = new SerialDisposable(),
|
307
|
+
totalTime = 0;
|
308
|
+
groupDisposable = new CompositeDisposable(timerD),
|
309
|
+
refCountDisposable = new RefCountDisposable(groupDisposable);
|
318
310
|
|
319
311
|
function createTimer () {
|
320
312
|
var m = new SingleAssignmentDisposable(),
|
321
|
-
|
322
|
-
|
313
|
+
isSpan = false,
|
314
|
+
isShift = false;
|
323
315
|
timerD.setDisposable(m);
|
324
316
|
if (nextSpan === nextShift) {
|
325
317
|
isSpan = true;
|
@@ -330,7 +322,7 @@
|
|
330
322
|
isShift = true;
|
331
323
|
}
|
332
324
|
var newTotalTime = isSpan ? nextSpan : nextShift,
|
333
|
-
|
325
|
+
ts = newTotalTime - totalTime;
|
334
326
|
totalTime = newTotalTime;
|
335
327
|
if (isSpan) {
|
336
328
|
nextSpan += timeShift;
|
@@ -339,40 +331,35 @@
|
|
339
331
|
nextShift += timeShift;
|
340
332
|
}
|
341
333
|
m.setDisposable(scheduler.scheduleWithRelative(ts, function () {
|
342
|
-
var s;
|
343
334
|
if (isShift) {
|
344
|
-
s = new Subject();
|
335
|
+
var s = new Subject();
|
345
336
|
q.push(s);
|
346
337
|
observer.onNext(addRef(s, refCountDisposable));
|
347
338
|
}
|
348
|
-
|
349
|
-
s = q.shift();
|
350
|
-
s.onCompleted();
|
351
|
-
}
|
339
|
+
isSpan && q.shift().onCompleted();
|
352
340
|
createTimer();
|
353
341
|
}));
|
354
342
|
};
|
355
343
|
q.push(new Subject());
|
356
344
|
observer.onNext(addRef(q[0], refCountDisposable));
|
357
345
|
createTimer();
|
358
|
-
groupDisposable.add(source.subscribe(
|
359
|
-
|
360
|
-
q[i].onNext(x);
|
361
|
-
}
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
}
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
q[i].onCompleted();
|
346
|
+
groupDisposable.add(source.subscribe(
|
347
|
+
function (x) {
|
348
|
+
for (var i = 0, len = q.length; i < len; i++) { q[i].onNext(x); }
|
349
|
+
},
|
350
|
+
function (e) {
|
351
|
+
for (var i = 0, len = q.length; i < len; i++) { q[i].onError(e); }
|
352
|
+
observer.onError(e);
|
353
|
+
},
|
354
|
+
function () {
|
355
|
+
for (var i = 0, len = q.length; i < len; i++) { q[i].onCompleted(); }
|
356
|
+
observer.onCompleted();
|
370
357
|
}
|
371
|
-
|
372
|
-
}));
|
358
|
+
));
|
373
359
|
return refCountDisposable;
|
374
360
|
});
|
375
361
|
};
|
362
|
+
|
376
363
|
/**
|
377
364
|
* Projects each element of an observable sequence into a window that is completed when either it's full or a given amount of time has elapsed.
|
378
365
|
* @param {Number} timeSpan Maximum time length of a window.
|
@@ -384,66 +371,63 @@
|
|
384
371
|
var source = this;
|
385
372
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
386
373
|
return new AnonymousObservable(function (observer) {
|
387
|
-
var
|
388
|
-
groupDisposable,
|
374
|
+
var timerD = new SerialDisposable(),
|
375
|
+
groupDisposable = new CompositeDisposable(timerD),
|
376
|
+
refCountDisposable = new RefCountDisposable(groupDisposable),
|
389
377
|
n = 0,
|
390
|
-
|
391
|
-
s
|
392
|
-
|
393
|
-
|
394
|
-
groupDisposable = new CompositeDisposable(timerD);
|
395
|
-
refCountDisposable = new RefCountDisposable(groupDisposable);
|
396
|
-
createTimer = function (id) {
|
378
|
+
windowId = 0,
|
379
|
+
s = new Subject();
|
380
|
+
|
381
|
+
function createTimer(id) {
|
397
382
|
var m = new SingleAssignmentDisposable();
|
398
383
|
timerD.setDisposable(m);
|
399
384
|
m.setDisposable(scheduler.scheduleWithRelative(timeSpan, function () {
|
400
|
-
|
401
|
-
if (id !== windowId) {
|
402
|
-
return;
|
403
|
-
}
|
385
|
+
if (id !== windowId) { return; }
|
404
386
|
n = 0;
|
405
|
-
newId = ++windowId;
|
387
|
+
var newId = ++windowId;
|
406
388
|
s.onCompleted();
|
407
389
|
s = new Subject();
|
408
390
|
observer.onNext(addRef(s, refCountDisposable));
|
409
391
|
createTimer(newId);
|
410
392
|
}));
|
411
|
-
}
|
412
|
-
|
393
|
+
}
|
394
|
+
|
413
395
|
observer.onNext(addRef(s, refCountDisposable));
|
414
396
|
createTimer(0);
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
397
|
+
|
398
|
+
groupDisposable.add(source.subscribe(
|
399
|
+
function (x) {
|
400
|
+
var newId = 0, newWindow = false;
|
401
|
+
s.onNext(x);
|
402
|
+
if (++n === count) {
|
403
|
+
newWindow = true;
|
404
|
+
n = 0;
|
405
|
+
newId = ++windowId;
|
406
|
+
s.onCompleted();
|
407
|
+
s = new Subject();
|
408
|
+
observer.onNext(addRef(s, refCountDisposable));
|
409
|
+
}
|
410
|
+
newWindow && createTimer(newId);
|
411
|
+
},
|
412
|
+
function (e) {
|
413
|
+
s.onError(e);
|
414
|
+
observer.onError(e);
|
415
|
+
}, function () {
|
423
416
|
s.onCompleted();
|
424
|
-
|
425
|
-
observer.onNext(addRef(s, refCountDisposable));
|
426
|
-
}
|
427
|
-
if (newWindow) {
|
428
|
-
createTimer(newId);
|
417
|
+
observer.onCompleted();
|
429
418
|
}
|
430
|
-
|
431
|
-
s.onError(e);
|
432
|
-
observer.onError(e);
|
433
|
-
}, function () {
|
434
|
-
s.onCompleted();
|
435
|
-
observer.onCompleted();
|
436
|
-
}));
|
419
|
+
));
|
437
420
|
return refCountDisposable;
|
438
421
|
});
|
439
422
|
};
|
423
|
+
|
440
424
|
/**
|
441
425
|
* Projects each element of an observable sequence into zero or more buffers which are produced based on timing information.
|
442
|
-
*
|
426
|
+
*
|
443
427
|
* @example
|
444
428
|
* 1 - res = xs.bufferWithTime(1000, scheduler); // non-overlapping segments of 1 second
|
445
429
|
* 2 - res = xs.bufferWithTime(1000, 500, scheduler; // segments of 1 second with time shift 0.5 seconds
|
446
|
-
*
|
430
|
+
*
|
447
431
|
* @param {Number} timeSpan Length of each buffer (specified as an integer denoting milliseconds).
|
448
432
|
* @param {Mixed} [timeShiftOrScheduler] Interval between creation of consecutive buffers (specified as an integer denoting milliseconds), or an optional scheduler parameter. If not specified, the time shift corresponds to the timeSpan parameter, resulting in non-overlapping adjacent buffers.
|
449
433
|
* @param {Scheduler} [scheduler] Scheduler to run buffer timers on. If not specified, the timeout scheduler is used.
|
@@ -455,11 +439,11 @@
|
|
455
439
|
|
456
440
|
/**
|
457
441
|
* Projects each element of an observable sequence into a buffer that is completed when either it's full or a given amount of time has elapsed.
|
458
|
-
*
|
442
|
+
*
|
459
443
|
* @example
|
460
|
-
* 1 - res = source.bufferWithTimeOrCount(5000, 50); // 5s or 50 items in an array
|
444
|
+
* 1 - res = source.bufferWithTimeOrCount(5000, 50); // 5s or 50 items in an array
|
461
445
|
* 2 - res = source.bufferWithTimeOrCount(5000, 50, scheduler); // 5s or 50 items in an array
|
462
|
-
*
|
446
|
+
*
|
463
447
|
* @param {Number} timeSpan Maximum time length of a buffer.
|
464
448
|
* @param {Number} count Maximum element count of a buffer.
|
465
449
|
* @param {Scheduler} [scheduler] Scheduler to run bufferin timers on. If not specified, the timeout scheduler is used.
|
@@ -473,11 +457,11 @@
|
|
473
457
|
|
474
458
|
/**
|
475
459
|
* Records the time interval between consecutive values in an observable sequence.
|
476
|
-
*
|
460
|
+
*
|
477
461
|
* @example
|
478
462
|
* 1 - res = source.timeInterval();
|
479
463
|
* 2 - res = source.timeInterval(Rx.Scheduler.timeout);
|
480
|
-
*
|
464
|
+
*
|
481
465
|
* @param [scheduler] Scheduler used to compute time intervals. If not specified, the timeout scheduler is used.
|
482
466
|
* @returns {Observable} An observable sequence with time interval information on values.
|
483
467
|
*/
|
@@ -496,11 +480,11 @@
|
|
496
480
|
|
497
481
|
/**
|
498
482
|
* Records the timestamp for each value in an observable sequence.
|
499
|
-
*
|
483
|
+
*
|
500
484
|
* @example
|
501
485
|
* 1 - res = source.timestamp(); // produces { value: x, timestamp: ts }
|
502
486
|
* 2 - res = source.timestamp(Rx.Scheduler.timeout);
|
503
|
-
*
|
487
|
+
*
|
504
488
|
* @param {Scheduler} [scheduler] Scheduler used to compute timestamps. If not specified, the timeout scheduler is used.
|
505
489
|
* @returns {Observable} An observable sequence with timestamp information on values.
|
506
490
|
*/
|
@@ -512,7 +496,7 @@
|
|
512
496
|
};
|
513
497
|
|
514
498
|
function sampleObservable(source, sampler) {
|
515
|
-
|
499
|
+
|
516
500
|
return new AnonymousObservable(function (observer) {
|
517
501
|
var atEnd, value, hasValue;
|
518
502
|
|
@@ -538,12 +522,12 @@
|
|
538
522
|
|
539
523
|
/**
|
540
524
|
* Samples the observable sequence at each interval.
|
541
|
-
*
|
525
|
+
*
|
542
526
|
* @example
|
543
527
|
* 1 - res = source.sample(sampleObservable); // Sampler tick sequence
|
544
528
|
* 2 - res = source.sample(5000); // 5 seconds
|
545
529
|
* 2 - res = source.sample(5000, Rx.Scheduler.timeout); // 5 seconds
|
546
|
-
*
|
530
|
+
*
|
547
531
|
* @param {Mixed} intervalOrSampler Interval at which to sample (specified as an integer denoting milliseconds) or Sampler Observable.
|
548
532
|
* @param {Scheduler} [scheduler] Scheduler to run the sampling timer on. If not specified, the timeout scheduler is used.
|
549
533
|
* @returns {Observable} Sampled observable sequence.
|
@@ -556,7 +540,7 @@
|
|
556
540
|
};
|
557
541
|
|
558
542
|
/**
|
559
|
-
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
|
543
|
+
* Returns the source observable sequence or the other observable sequence if dueTime elapses.
|
560
544
|
* @param {Number} dueTime Absolute (specified as a Date object) or relative time (specified as an integer denoting milliseconds) when a timeout occurs.
|
561
545
|
* @param {Observable} [other] Sequence to return in case of a timeout. If not specified, a timeout error throwing sequence will be used.
|
562
546
|
* @param {Scheduler} [scheduler] Scheduler to run the timeout timers on. If not specified, the timeout scheduler is used.
|
@@ -565,7 +549,7 @@
|
|
565
549
|
observableProto.timeout = function (dueTime, other, scheduler) {
|
566
550
|
other || (other = observableThrow(new Error('Timeout')));
|
567
551
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
568
|
-
|
552
|
+
|
569
553
|
var source = this, schedulerMethod = dueTime instanceof Date ?
|
570
554
|
'scheduleWithAbsolute' :
|
571
555
|
'scheduleWithRelative';
|
@@ -590,7 +574,7 @@
|
|
590
574
|
}
|
591
575
|
|
592
576
|
createTimer();
|
593
|
-
|
577
|
+
|
594
578
|
original.setDisposable(source.subscribe(function (x) {
|
595
579
|
if (!switched) {
|
596
580
|
id++;
|
@@ -614,15 +598,15 @@
|
|
614
598
|
|
615
599
|
/**
|
616
600
|
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
|
617
|
-
*
|
601
|
+
*
|
618
602
|
* @example
|
619
|
-
* res = source.generateWithAbsoluteTime(0,
|
620
|
-
* function (x) { return return true; },
|
621
|
-
* function (x) { return x + 1; },
|
622
|
-
* function (x) { return x; },
|
603
|
+
* res = source.generateWithAbsoluteTime(0,
|
604
|
+
* function (x) { return return true; },
|
605
|
+
* function (x) { return x + 1; },
|
606
|
+
* function (x) { return x; },
|
623
607
|
* function (x) { return new Date(); }
|
624
608
|
* });
|
625
|
-
*
|
609
|
+
*
|
626
610
|
* @param {Mixed} initialState Initial state.
|
627
611
|
* @param {Function} condition Condition to terminate generation (upon returning false).
|
628
612
|
* @param {Function} iterate Iteration step function.
|
@@ -641,7 +625,7 @@
|
|
641
625
|
time;
|
642
626
|
return scheduler.scheduleRecursiveWithAbsolute(scheduler.now(), function (self) {
|
643
627
|
hasResult && observer.onNext(result);
|
644
|
-
|
628
|
+
|
645
629
|
try {
|
646
630
|
if (first) {
|
647
631
|
first = false;
|
@@ -668,15 +652,15 @@
|
|
668
652
|
|
669
653
|
/**
|
670
654
|
* Generates an observable sequence by iterating a state from an initial state until the condition fails.
|
671
|
-
*
|
672
|
-
* @example
|
673
|
-
* res = source.generateWithRelativeTime(0,
|
674
|
-
* function (x) { return return true; },
|
675
|
-
* function (x) { return x + 1; },
|
676
|
-
* function (x) { return x; },
|
655
|
+
*
|
656
|
+
* @example
|
657
|
+
* res = source.generateWithRelativeTime(0,
|
658
|
+
* function (x) { return return true; },
|
659
|
+
* function (x) { return x + 1; },
|
660
|
+
* function (x) { return x; },
|
677
661
|
* function (x) { return 500; }
|
678
662
|
* );
|
679
|
-
*
|
663
|
+
*
|
680
664
|
* @param {Mixed} initialState Initial state.
|
681
665
|
* @param {Function} condition Condition to terminate generation (upon returning false).
|
682
666
|
* @param {Function} iterate Iteration step function.
|
@@ -722,11 +706,11 @@
|
|
722
706
|
|
723
707
|
/**
|
724
708
|
* Time shifts the observable sequence by delaying the subscription.
|
725
|
-
*
|
709
|
+
*
|
726
710
|
* @example
|
727
711
|
* 1 - res = source.delaySubscription(5000); // 5s
|
728
712
|
* 2 - res = source.delaySubscription(5000, Rx.Scheduler.timeout); // 5 seconds
|
729
|
-
*
|
713
|
+
*
|
730
714
|
* @param {Number} dueTime Absolute or relative time to perform the subscription at.
|
731
715
|
* @param {Scheduler} [scheduler] Scheduler to run the subscription delay timer on. If not specified, the timeout scheduler is used.
|
732
716
|
* @returns {Observable} Time-shifted sequence.
|
@@ -737,12 +721,12 @@
|
|
737
721
|
|
738
722
|
/**
|
739
723
|
* Time shifts the observable sequence based on a subscription delay and a delay selector function for each element.
|
740
|
-
*
|
724
|
+
*
|
741
725
|
* @example
|
742
726
|
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(5000); }); // with selector only
|
743
727
|
* 1 - res = source.delayWithSelector(Rx.Observable.timer(2000), function (x) { return Rx.Observable.timer(x); }); // with delay and selector
|
744
728
|
*
|
745
|
-
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
|
729
|
+
* @param {Observable} [subscriptionDelay] Sequence indicating the delay for the subscription to the source.
|
746
730
|
* @param {Function} delayDurationSelector Selector function to retrieve a sequence indicating the delay for each given element.
|
747
731
|
* @returns {Observable} Time-shifted sequence.
|
748
732
|
*/
|
@@ -802,7 +786,7 @@
|
|
802
786
|
* Returns the source observable sequence, switching to the other observable sequence if a timeout is signaled.
|
803
787
|
* @param {Observable} [firstTimeout] Observable sequence that represents the timeout for the first element. If not provided, this defaults to Observable.never().
|
804
788
|
* @param {Function} [timeoutDurationSelector] Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
|
805
|
-
* @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
|
789
|
+
* @param {Observable} [other] Sequence to return in case of a timeout. If not provided, this is set to Observable.throwException().
|
806
790
|
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
|
807
791
|
*/
|
808
792
|
observableProto.timeoutWithSelector = function (firstTimeout, timeoutdurationSelector, other) {
|
@@ -820,7 +804,7 @@
|
|
820
804
|
var id = 0, switched = false;
|
821
805
|
|
822
806
|
function setTimer(timeout) {
|
823
|
-
var myId = id;
|
807
|
+
var myId = id;
|
824
808
|
|
825
809
|
function timerWins () {
|
826
810
|
return id === myId;
|
@@ -869,10 +853,10 @@
|
|
869
853
|
|
870
854
|
/**
|
871
855
|
* Ignores values from an observable sequence which are followed by another value within a computed throttle duration.
|
872
|
-
*
|
856
|
+
*
|
873
857
|
* @example
|
874
|
-
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(x + x); });
|
875
|
-
*
|
858
|
+
* 1 - res = source.delayWithSelector(function (x) { return Rx.Scheduler.timer(x + x); });
|
859
|
+
*
|
876
860
|
* @param {Function} throttleDurationSelector Selector function to retrieve a sequence indicating the throttle duration for each given element.
|
877
861
|
* @returns {Observable} The throttled sequence.
|
878
862
|
*/
|
@@ -923,14 +907,14 @@
|
|
923
907
|
|
924
908
|
/**
|
925
909
|
* Skips elements for the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
|
926
|
-
*
|
927
|
-
* 1 - res = source.skipLastWithTime(5000);
|
928
|
-
* 2 - res = source.skipLastWithTime(5000, scheduler);
|
929
|
-
*
|
910
|
+
*
|
911
|
+
* 1 - res = source.skipLastWithTime(5000);
|
912
|
+
* 2 - res = source.skipLastWithTime(5000, scheduler);
|
913
|
+
*
|
930
914
|
* @description
|
931
915
|
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
|
932
916
|
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
|
933
|
-
* result sequence. This causes elements to be delayed with duration.
|
917
|
+
* result sequence. This causes elements to be delayed with duration.
|
934
918
|
* @param {Number} duration Duration for skipping elements from the end of the sequence.
|
935
919
|
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout
|
936
920
|
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the end of the source sequence.
|
@@ -961,7 +945,7 @@
|
|
961
945
|
* @description
|
962
946
|
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
|
963
947
|
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
|
964
|
-
* result sequence. This causes elements to be delayed with duration.
|
948
|
+
* result sequence. This causes elements to be delayed with duration.
|
965
949
|
* @param {Number} duration Duration for taking elements from the end of the sequence.
|
966
950
|
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
|
967
951
|
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the end of the source sequence.
|
@@ -985,7 +969,7 @@
|
|
985
969
|
}
|
986
970
|
observer.onCompleted();
|
987
971
|
});
|
988
|
-
});
|
972
|
+
});
|
989
973
|
};
|
990
974
|
|
991
975
|
/**
|
@@ -993,7 +977,7 @@
|
|
993
977
|
* @description
|
994
978
|
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
|
995
979
|
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
|
996
|
-
* result sequence. This causes elements to be delayed with duration.
|
980
|
+
* result sequence. This causes elements to be delayed with duration.
|
997
981
|
* @param {Number} duration Duration for taking elements from the end of the sequence.
|
998
982
|
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
|
999
983
|
* @returns {Observable} An observable sequence containing a single array with the elements taken during the specified duration from the end of the source sequence.
|
@@ -1023,13 +1007,13 @@
|
|
1023
1007
|
|
1024
1008
|
/**
|
1025
1009
|
* Takes elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
|
1026
|
-
*
|
1010
|
+
*
|
1027
1011
|
* @example
|
1028
|
-
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
|
1012
|
+
* 1 - res = source.takeWithTime(5000, [optional scheduler]);
|
1029
1013
|
* @description
|
1030
1014
|
* This operator accumulates a queue with a length enough to store elements received during the initial duration window.
|
1031
1015
|
* As more elements are received, elements older than the specified duration are taken from the queue and produced on the
|
1032
|
-
* result sequence. This causes elements to be delayed with duration.
|
1016
|
+
* result sequence. This causes elements to be delayed with duration.
|
1033
1017
|
* @param {Number} duration Duration for taking elements from the start of the sequence.
|
1034
1018
|
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
|
1035
1019
|
* @returns {Observable} An observable sequence with the elements taken during the specified duration from the start of the source sequence.
|
@@ -1044,16 +1028,16 @@
|
|
1044
1028
|
|
1045
1029
|
/**
|
1046
1030
|
* Skips elements for the specified duration from the start of the observable source sequence, using the specified scheduler to run timers.
|
1047
|
-
*
|
1031
|
+
*
|
1048
1032
|
* @example
|
1049
|
-
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
|
1050
|
-
*
|
1051
|
-
* @description
|
1033
|
+
* 1 - res = source.skipWithTime(5000, [optional scheduler]);
|
1034
|
+
*
|
1035
|
+
* @description
|
1052
1036
|
* Specifying a zero value for duration doesn't guarantee no elements will be dropped from the start of the source sequence.
|
1053
1037
|
* This is a side-effect of the asynchrony introduced by the scheduler, where the action that causes callbacks from the source sequence to be forwarded
|
1054
1038
|
* may not execute immediately, despite the zero due time.
|
1055
|
-
*
|
1056
|
-
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
|
1039
|
+
*
|
1040
|
+
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the duration.
|
1057
1041
|
* @param {Number} duration Duration for skipping elements from the start of the sequence.
|
1058
1042
|
* @param {Scheduler} scheduler Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
|
1059
1043
|
* @returns {Observable} An observable sequence with the elements skipped during the specified duration from the start of the source sequence.
|
@@ -1064,7 +1048,7 @@
|
|
1064
1048
|
return new AnonymousObservable(function (observer) {
|
1065
1049
|
var open = false;
|
1066
1050
|
return new CompositeDisposable(
|
1067
|
-
scheduler.scheduleWithRelative(duration, function () { open = true; }),
|
1051
|
+
scheduler.scheduleWithRelative(duration, function () { open = true; }),
|
1068
1052
|
source.subscribe(function (x) { open && observer.onNext(x); }, observer.onError.bind(observer), observer.onCompleted.bind(observer)));
|
1069
1053
|
});
|
1070
1054
|
};
|
@@ -1072,13 +1056,13 @@
|
|
1072
1056
|
/**
|
1073
1057
|
* Skips elements from the observable source sequence until the specified start time, using the specified scheduler to run timers.
|
1074
1058
|
* Errors produced by the source sequence are always forwarded to the result sequence, even if the error occurs before the start time.
|
1075
|
-
*
|
1059
|
+
*
|
1076
1060
|
* @examples
|
1077
|
-
* 1 - res = source.skipUntilWithTime(new Date(), [scheduler]);
|
1078
|
-
* 2 - res = source.skipUntilWithTime(5000, [scheduler]);
|
1061
|
+
* 1 - res = source.skipUntilWithTime(new Date(), [scheduler]);
|
1062
|
+
* 2 - res = source.skipUntilWithTime(5000, [scheduler]);
|
1079
1063
|
* @param {Date|Number} startTime Time to start taking elements from the source sequence. If this value is less than or equal to Date(), no elements will be skipped.
|
1080
1064
|
* @param {Scheduler} [scheduler] Scheduler to run the timer on. If not specified, defaults to Rx.Scheduler.timeout.
|
1081
|
-
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
|
1065
|
+
* @returns {Observable} An observable sequence with the elements skipped until the specified start time.
|
1082
1066
|
*/
|
1083
1067
|
observableProto.skipUntilWithTime = function (startTime, scheduler) {
|
1084
1068
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
@@ -1091,14 +1075,14 @@
|
|
1091
1075
|
return new CompositeDisposable(
|
1092
1076
|
scheduler[schedulerMethod](startTime, function () { open = true; }),
|
1093
1077
|
source.subscribe(
|
1094
|
-
function (x) { open && observer.onNext(x); },
|
1078
|
+
function (x) { open && observer.onNext(x); },
|
1095
1079
|
observer.onError.bind(observer),
|
1096
1080
|
observer.onCompleted.bind(observer)));
|
1097
1081
|
});
|
1098
1082
|
};
|
1099
1083
|
|
1100
1084
|
/**
|
1101
|
-
* Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
|
1085
|
+
* Takes elements for the specified duration until the specified end time, using the specified scheduler to run timers.
|
1102
1086
|
* @param {Number | Date} endTime Time to stop taking elements from the source sequence. If this value is less than or equal to new Date(), the result stream will complete immediately.
|
1103
1087
|
* @param {Scheduler} [scheduler] Scheduler to run the timer on.
|
1104
1088
|
* @returns {Observable} An observable sequence with the elements taken until the specified end time.
|
@@ -1110,10 +1094,10 @@
|
|
1110
1094
|
'scheduleWithRelative';
|
1111
1095
|
return new AnonymousObservable(function (observer) {
|
1112
1096
|
return new CompositeDisposable(
|
1113
|
-
scheduler[schedulerMethod](endTime, observer.onCompleted.bind(observer)),
|
1097
|
+
scheduler[schedulerMethod](endTime, observer.onCompleted.bind(observer)),
|
1114
1098
|
source.subscribe(observer));
|
1115
1099
|
});
|
1116
1100
|
};
|
1117
1101
|
|
1118
|
-
return Rx;
|
1119
|
-
}));
|
1102
|
+
return Rx;
|
1103
|
+
}));
|