rxjs-rails 2.3.0 → 2.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.js +115 -27
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.all.compat.js +2751 -2702
- data/vendor/assets/javascripts/rx.all.compat.min.js +3 -3
- data/vendor/assets/javascripts/rx.all.js +2605 -2589
- data/vendor/assets/javascripts/rx.all.min.js +3 -3
- data/vendor/assets/javascripts/rx.async.compat.js +41 -22
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +41 -22
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.backpressure.js +41 -45
- data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
- data/vendor/assets/javascripts/rx.binding.js +81 -111
- data/vendor/assets/javascripts/rx.binding.min.js +1 -1
- data/vendor/assets/javascripts/rx.coincidence.js +567 -486
- data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +1430 -1532
- data/vendor/assets/javascripts/rx.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.core.compat.js +76 -127
- data/vendor/assets/javascripts/rx.core.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.core.js +76 -127
- data/vendor/assets/javascripts/rx.core.min.js +1 -1
- data/vendor/assets/javascripts/rx.experimental.js +36 -36
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
- data/vendor/assets/javascripts/rx.joinpatterns.js +281 -281
- data/vendor/assets/javascripts/rx.js +1286 -1421
- data/vendor/assets/javascripts/rx.lite.compat.js +1443 -1749
- data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.lite.extras.js +133 -205
- data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
- data/vendor/assets/javascripts/rx.lite.js +1319 -1658
- data/vendor/assets/javascripts/rx.lite.min.js +2 -2
- data/vendor/assets/javascripts/rx.min.js +2 -2
- data/vendor/assets/javascripts/rx.testing.js +302 -322
- data/vendor/assets/javascripts/rx.testing.min.js +1 -1
- data/vendor/assets/javascripts/rx.time.js +90 -75
- data/vendor/assets/javascripts/rx.time.min.js +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.js +264 -279
- data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -1
- metadata +10 -11
@@ -1,4 +1,4 @@
|
|
1
|
-
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
1
|
+
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
2
|
|
3
3
|
;(function (factory) {
|
4
4
|
var objectTypes = {
|
@@ -33,335 +33,315 @@
|
|
33
33
|
}
|
34
34
|
}.call(this, function (root, exp, Rx, undefined) {
|
35
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
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
}
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
}
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
/**
|
84
|
-
|
85
|
-
* @memberOf OnErrorPredicate#
|
86
|
-
*/
|
87
|
-
OnErrorPredicate.prototype.equals = function (other) {
|
88
|
-
if (other === this) { return true; }
|
89
|
-
if (other == null) { return false; }
|
90
|
-
if (other.kind !== 'E') { return false; }
|
91
|
-
return this.predicate(other.exception);
|
92
|
-
};
|
93
|
-
|
94
|
-
/**
|
95
|
-
* @static
|
96
|
-
* type Object
|
97
|
-
*/
|
98
|
-
var ReactiveTest = Rx.ReactiveTest = {
|
99
|
-
/** Default virtual time used for creation of observable sequences in unit tests. */
|
100
|
-
created: 100,
|
101
|
-
/** Default virtual time used to subscribe to observable sequences in unit tests. */
|
102
|
-
subscribed: 200,
|
103
|
-
/** Default virtual time used to dispose subscriptions in unit tests. */
|
104
|
-
disposed: 1000,
|
105
|
-
|
106
|
-
/**
|
107
|
-
* Factory method for an OnNext notification record at a given time with a given value or a predicate function.
|
108
|
-
*
|
109
|
-
* 1 - ReactiveTest.onNext(200, 42);
|
110
|
-
* 2 - ReactiveTest.onNext(200, function (x) { return x.length == 2; });
|
111
|
-
*
|
112
|
-
* @param ticks Recorded virtual time the OnNext notification occurs.
|
113
|
-
* @param value Recorded value stored in the OnNext notification or a predicate.
|
114
|
-
* @return Recorded OnNext notification.
|
115
|
-
*/
|
116
|
-
onNext: function (ticks, value) {
|
117
|
-
if (typeof value === 'function') {
|
118
|
-
return new Recorded(ticks, new OnNextPredicate(value));
|
119
|
-
}
|
120
|
-
return new Recorded(ticks, Notification.createOnNext(value));
|
121
|
-
},
|
122
|
-
/**
|
123
|
-
* Factory method for an OnError notification record at a given time with a given error.
|
124
|
-
*
|
125
|
-
* 1 - ReactiveTest.onNext(200, new Error('error'));
|
126
|
-
* 2 - ReactiveTest.onNext(200, function (e) { return e.message === 'error'; });
|
127
|
-
*
|
128
|
-
* @param ticks Recorded virtual time the OnError notification occurs.
|
129
|
-
* @param exception Recorded exception stored in the OnError notification.
|
130
|
-
* @return Recorded OnError notification.
|
131
|
-
*/
|
132
|
-
onError: function (ticks, exception) {
|
133
|
-
if (typeof exception === 'function') {
|
134
|
-
return new Recorded(ticks, new OnErrorPredicate(exception));
|
135
|
-
}
|
136
|
-
return new Recorded(ticks, Notification.createOnError(exception));
|
137
|
-
},
|
138
|
-
/**
|
139
|
-
* Factory method for an OnCompleted notification record at a given time.
|
140
|
-
*
|
141
|
-
* @param ticks Recorded virtual time the OnCompleted notification occurs.
|
142
|
-
* @return Recorded OnCompleted notification.
|
143
|
-
*/
|
144
|
-
onCompleted: function (ticks) {
|
145
|
-
return new Recorded(ticks, Notification.createOnCompleted());
|
146
|
-
},
|
147
|
-
/**
|
148
|
-
* Factory method for a subscription record based on a given subscription and disposal time.
|
149
|
-
*
|
150
|
-
* @param start Virtual time indicating when the subscription was created.
|
151
|
-
* @param end Virtual time indicating when the subscription was disposed.
|
152
|
-
* @return Subscription object.
|
153
|
-
*/
|
154
|
-
subscribe: function (start, end) {
|
155
|
-
return new Subscription(start, end);
|
156
|
-
}
|
157
|
-
};
|
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
|
+
|
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,
|
158
85
|
|
159
86
|
/**
|
160
|
-
*
|
161
|
-
*
|
162
|
-
*
|
163
|
-
*
|
164
|
-
*
|
165
|
-
* @param
|
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.
|
166
95
|
*/
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
/**
|
174
|
-
* Checks whether the given recorded object is equal to the current instance.
|
175
|
-
*
|
176
|
-
* @param {Recorded} other Recorded object to check for equality.
|
177
|
-
* @returns {Boolean} true if both objects are equal; false otherwise.
|
178
|
-
*/
|
179
|
-
Recorded.prototype.equals = function (other) {
|
180
|
-
return this.time === other.time && this.comparer(this.value, other.value);
|
181
|
-
};
|
182
|
-
|
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
|
+
},
|
183
102
|
/**
|
184
|
-
*
|
185
|
-
*
|
186
|
-
*
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
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
|
+
},
|
192
118
|
/**
|
193
|
-
*
|
119
|
+
* Factory method for an OnCompleted notification record at a given time.
|
194
120
|
*
|
195
|
-
* @
|
196
|
-
* @
|
197
|
-
* @param {Number} unsubscribe Virtual time at which the unsubscription occurred.
|
121
|
+
* @param ticks Recorded virtual time the OnCompleted notification occurs.
|
122
|
+
* @return Recorded OnCompleted notification.
|
198
123
|
*/
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
};
|
203
|
-
|
124
|
+
onCompleted: function (ticks) {
|
125
|
+
return new Recorded(ticks, Notification.createOnCompleted());
|
126
|
+
},
|
204
127
|
/**
|
205
|
-
*
|
206
|
-
*
|
207
|
-
* @
|
208
|
-
|
209
|
-
|
210
|
-
return this.subscribe === other.subscribe && this.unsubscribe === other.unsubscribe;
|
211
|
-
};
|
212
|
-
|
213
|
-
/**
|
214
|
-
* Returns a string representation of the current Subscription value.
|
215
|
-
* @returns {String} String representation of the current Subscription value.
|
216
|
-
*/
|
217
|
-
Subscription.prototype.toString = function () {
|
218
|
-
return '(' + this.subscribe + ', ' + this.unsubscribe === Number.MAX_VALUE ? 'Infinite' : this.unsubscribe + ')';
|
219
|
-
};
|
220
|
-
|
221
|
-
/** @private */
|
222
|
-
var MockDisposable = Rx.MockDisposable = function (scheduler) {
|
223
|
-
this.scheduler = scheduler;
|
224
|
-
this.disposes = [];
|
225
|
-
this.disposes.push(this.scheduler.clock);
|
226
|
-
};
|
227
|
-
|
228
|
-
/*
|
229
|
-
* @memberOf MockDisposable#
|
230
|
-
* @prviate
|
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.
|
231
133
|
*/
|
232
|
-
|
233
|
-
|
234
|
-
}
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
134
|
+
subscribe: function (start, end) {
|
135
|
+
return new Subscription(start, end);
|
136
|
+
}
|
137
|
+
};
|
138
|
+
|
139
|
+
/**
|
140
|
+
* Creates a new object recording the production of the specified value at the given virtual time.
|
141
|
+
*
|
142
|
+
* @constructor
|
143
|
+
* @param {Number} time Virtual time the value was produced on.
|
144
|
+
* @param {Mixed} value Value that was produced.
|
145
|
+
* @param {Function} comparer An optional comparer.
|
146
|
+
*/
|
147
|
+
var Recorded = Rx.Recorded = function (time, value, comparer) {
|
148
|
+
this.time = time;
|
149
|
+
this.value = value;
|
150
|
+
this.comparer = comparer || defaultComparer;
|
151
|
+
};
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Checks whether the given recorded object is equal to the current instance.
|
155
|
+
*
|
156
|
+
* @param {Recorded} other Recorded object to check for equality.
|
157
|
+
* @returns {Boolean} true if both objects are equal; false otherwise.
|
158
|
+
*/
|
159
|
+
Recorded.prototype.equals = function (other) {
|
160
|
+
return this.time === other.time && this.comparer(this.value, other.value);
|
161
|
+
};
|
162
|
+
|
163
|
+
/**
|
164
|
+
* Returns a string representation of the current Recorded value.
|
165
|
+
*
|
166
|
+
* @returns {String} String representation of the current Recorded value.
|
167
|
+
*/
|
168
|
+
Recorded.prototype.toString = function () {
|
169
|
+
return this.value.toString() + '@' + this.time;
|
170
|
+
};
|
171
|
+
|
172
|
+
/**
|
173
|
+
* Creates a new subscription object with the given virtual subscription and unsubscription time.
|
174
|
+
*
|
175
|
+
* @constructor
|
176
|
+
* @param {Number} subscribe Virtual time at which the subscription occurred.
|
177
|
+
* @param {Number} unsubscribe Virtual time at which the unsubscription occurred.
|
178
|
+
*/
|
179
|
+
var Subscription = Rx.Subscription = function (start, end) {
|
180
|
+
this.subscribe = start;
|
181
|
+
this.unsubscribe = end || Number.MAX_VALUE;
|
182
|
+
};
|
183
|
+
|
184
|
+
/**
|
185
|
+
* Checks whether the given subscription is equal to the current instance.
|
186
|
+
* @param other Subscription object to check for equality.
|
187
|
+
* @returns {Boolean} true if both objects are equal; false otherwise.
|
188
|
+
*/
|
189
|
+
Subscription.prototype.equals = function (other) {
|
190
|
+
return this.subscribe === other.subscribe && this.unsubscribe === other.unsubscribe;
|
191
|
+
};
|
192
|
+
|
193
|
+
/**
|
194
|
+
* Returns a string representation of the current Subscription value.
|
195
|
+
* @returns {String} String representation of the current Subscription value.
|
196
|
+
*/
|
197
|
+
Subscription.prototype.toString = function () {
|
198
|
+
return '(' + this.subscribe + ', ' + (this.unsubscribe === Number.MAX_VALUE ? 'Infinite' : this.unsubscribe) + ')';
|
199
|
+
};
|
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);
|
365
345
|
|
366
346
|
/** Virtual time scheduler used for testing applications and libraries built using Reactive Extensions. */
|
367
347
|
Rx.TestScheduler = (function (_super) {
|
@@ -496,5 +476,5 @@
|
|
496
476
|
return TestScheduler;
|
497
477
|
})(VirtualTimeScheduler);
|
498
478
|
|
499
|
-
return Rx;
|
479
|
+
return Rx;
|
500
480
|
}));
|