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,323 +31,233 @@
|
|
32
31
|
root.Rx = factory(root, {}, root.Rx);
|
33
32
|
}
|
34
33
|
}.call(this, function (root, exp, Rx, undefined) {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
}
|
68
|
-
|
69
|
-
/**
|
70
|
-
* @private
|
71
|
-
* @memberOf Map#
|
72
|
-
*/
|
73
|
-
Map.prototype['delete'] = function (key) {
|
74
|
-
var i = this.keys.indexOf(key);
|
75
|
-
if (i !== -1) {
|
76
|
-
this.keys.splice(i, 1);
|
77
|
-
this.values.splice(i, 1);
|
78
|
-
}
|
79
|
-
return i !== -1;
|
80
|
-
};
|
81
|
-
|
82
|
-
/**
|
83
|
-
* @private
|
84
|
-
* @memberOf Map#
|
85
|
-
*/
|
86
|
-
Map.prototype.get = function (key, fallback) {
|
87
|
-
var i = this.keys.indexOf(key);
|
88
|
-
return i !== -1 ? this.values[i] : fallback;
|
89
|
-
};
|
90
|
-
|
91
|
-
/**
|
92
|
-
* @private
|
93
|
-
* @memberOf Map#
|
94
|
-
*/
|
95
|
-
Map.prototype.set = function (key, value) {
|
96
|
-
var i = this.keys.indexOf(key);
|
97
|
-
if (i !== -1) {
|
98
|
-
this.values[i] = value;
|
99
|
-
}
|
100
|
-
this.values[this.keys.push(key) - 1] = value;
|
101
|
-
};
|
102
|
-
|
103
|
-
/**
|
104
|
-
* @private
|
105
|
-
* @memberOf Map#
|
106
|
-
*/
|
107
|
-
Map.prototype.size = function () { return this.keys.length; };
|
108
|
-
|
109
|
-
/**
|
110
|
-
* @private
|
111
|
-
* @memberOf Map#
|
112
|
-
*/
|
113
|
-
Map.prototype.has = function (key) {
|
114
|
-
return this.keys.indexOf(key) !== -1;
|
115
|
-
};
|
116
|
-
|
117
|
-
/**
|
118
|
-
* @private
|
119
|
-
* @memberOf Map#
|
120
|
-
*/
|
121
|
-
Map.prototype.getKeys = function () { return this.keys.slice(0); };
|
122
|
-
|
123
|
-
/**
|
124
|
-
* @private
|
125
|
-
* @memberOf Map#
|
126
|
-
*/
|
127
|
-
Map.prototype.getValues = function () { return this.values.slice(0); };
|
128
|
-
|
129
|
-
return Map;
|
130
|
-
}());
|
131
|
-
|
132
|
-
/**
|
133
|
-
* @constructor
|
134
|
-
* Represents a join pattern over observable sequences.
|
135
|
-
*/
|
136
|
-
function Pattern(patterns) {
|
137
|
-
this.patterns = patterns;
|
34
|
+
|
35
|
+
// Aliases
|
36
|
+
var Observable = Rx.Observable,
|
37
|
+
observableProto = Observable.prototype,
|
38
|
+
AnonymousObservable = Rx.AnonymousObservable,
|
39
|
+
observableThrow = Observable.throwException,
|
40
|
+
observerCreate = Rx.Observer.create,
|
41
|
+
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
|
42
|
+
CompositeDisposable = Rx.CompositeDisposable,
|
43
|
+
AbstractObserver = Rx.internals.AbstractObserver,
|
44
|
+
noop = Rx.helpers.noop,
|
45
|
+
defaultComparer = Rx.internals.isEqual,
|
46
|
+
inherits = Rx.internals.inherits,
|
47
|
+
Enumerable = Rx.internals.Enumerable,
|
48
|
+
Enumerator = Rx.internals.Enumerator,
|
49
|
+
$iterator$ = Rx.iterator,
|
50
|
+
doneEnumerator = Rx.doneEnumerator,
|
51
|
+
slice = Array.prototype.slice;
|
52
|
+
|
53
|
+
// Utilities
|
54
|
+
function argsOrArray(args, idx) {
|
55
|
+
return args.length === 1 && Array.isArray(args[idx]) ?
|
56
|
+
args[idx] :
|
57
|
+
slice.call(args);
|
58
|
+
}
|
59
|
+
|
60
|
+
/** @private */
|
61
|
+
var Map = root.Map || (function () {
|
62
|
+
|
63
|
+
function Map() {
|
64
|
+
this._keys = [];
|
65
|
+
this._values = [];
|
138
66
|
}
|
139
67
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
return new Pattern(patterns);
|
68
|
+
Map.prototype.get = function (key) {
|
69
|
+
var i = this._keys.indexOf(key);
|
70
|
+
return i !== -1 ? this._values[i] : undefined;
|
71
|
+
};
|
72
|
+
|
73
|
+
Map.prototype.set = function (key, value) {
|
74
|
+
var i = this._keys.indexOf(key);
|
75
|
+
i !== -1 && (this._values[i] = value);
|
76
|
+
this._values[this._keys.push(key) - 1] = value;
|
150
77
|
};
|
151
78
|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
* @return Plan that produces the projected values, to be fed (with other plans) to the when operator.
|
157
|
-
*/
|
158
|
-
Pattern.prototype.thenDo = function (selector) {
|
159
|
-
return new Plan(this, selector);
|
79
|
+
Map.prototype.forEach = function (callback, thisArg) {
|
80
|
+
for (var i = 0, len = this._keys.length; i < len; i++) {
|
81
|
+
callback.call(thisArg, this._values[i], this._keys[i]);
|
82
|
+
}
|
160
83
|
};
|
161
84
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
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
|
-
* @memberOf JoinObserver#
|
334
|
-
* @private
|
335
|
-
*/
|
336
|
-
JoinObserverPrototype.dispose = function () {
|
337
|
-
_super.prototype.dispose.call(this);
|
338
|
-
if (!this.isDisposed) {
|
339
|
-
this.isDisposed = true;
|
340
|
-
this.subscription.dispose();
|
341
|
-
}
|
342
|
-
};
|
343
|
-
|
344
|
-
return JoinObserver;
|
345
|
-
} (AbstractObserver));
|
85
|
+
return Map;
|
86
|
+
}());
|
87
|
+
|
88
|
+
/**
|
89
|
+
* @constructor
|
90
|
+
* Represents a join pattern over observable sequences.
|
91
|
+
*/
|
92
|
+
function Pattern(patterns) {
|
93
|
+
this.patterns = patterns;
|
94
|
+
}
|
95
|
+
|
96
|
+
/**
|
97
|
+
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
|
98
|
+
* @param other Observable sequence to match in addition to the current pattern.
|
99
|
+
* @return {Pattern} Pattern object that matches when all observable sequences in the pattern have an available value.
|
100
|
+
*/
|
101
|
+
Pattern.prototype.and = function (other) {
|
102
|
+
return new Pattern(this.patterns.concat(other));
|
103
|
+
};
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
|
107
|
+
* @param {Function} selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
|
108
|
+
* @return {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
|
109
|
+
*/
|
110
|
+
Pattern.prototype.thenDo = function (selector) {
|
111
|
+
return new Plan(this, selector);
|
112
|
+
};
|
113
|
+
|
114
|
+
function Plan(expression, selector) {
|
115
|
+
this.expression = expression;
|
116
|
+
this.selector = selector;
|
117
|
+
}
|
118
|
+
|
119
|
+
Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) {
|
120
|
+
var self = this;
|
121
|
+
var joinObservers = [];
|
122
|
+
for (var i = 0, len = this.expression.patterns.length; i < len; i++) {
|
123
|
+
joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], observer.onError.bind(observer)));
|
124
|
+
}
|
125
|
+
var activePlan = new ActivePlan(joinObservers, function () {
|
126
|
+
var result;
|
127
|
+
try {
|
128
|
+
result = self.selector.apply(self, arguments);
|
129
|
+
} catch (e) {
|
130
|
+
observer.onError(e);
|
131
|
+
return;
|
132
|
+
}
|
133
|
+
observer.onNext(result);
|
134
|
+
}, function () {
|
135
|
+
for (var j = 0, jlen = joinObservers.length; j < jlen; j++) {
|
136
|
+
joinObservers[j].removeActivePlan(activePlan);
|
137
|
+
}
|
138
|
+
deactivate(activePlan);
|
139
|
+
});
|
140
|
+
for (i = 0, len = joinObservers.length; i < len; i++) {
|
141
|
+
joinObservers[i].addActivePlan(activePlan);
|
142
|
+
}
|
143
|
+
return activePlan;
|
144
|
+
};
|
145
|
+
|
146
|
+
function planCreateObserver(externalSubscriptions, observable, onError) {
|
147
|
+
var entry = externalSubscriptions.get(observable);
|
148
|
+
if (!entry) {
|
149
|
+
var observer = new JoinObserver(observable, onError);
|
150
|
+
externalSubscriptions.set(observable, observer);
|
151
|
+
return observer;
|
152
|
+
}
|
153
|
+
return entry;
|
154
|
+
}
|
155
|
+
|
156
|
+
function ActivePlan(joinObserverArray, onNext, onCompleted) {
|
157
|
+
this.joinObserverArray = joinObserverArray;
|
158
|
+
this.onNext = onNext;
|
159
|
+
this.onCompleted = onCompleted;
|
160
|
+
this.joinObservers = new Map();
|
161
|
+
for (var i = 0, len = this.joinObserverArray.length; i < len; i++) {
|
162
|
+
var joinObserver = this.joinObserverArray[i];
|
163
|
+
this.joinObservers.set(joinObserver, joinObserver);
|
164
|
+
}
|
165
|
+
}
|
166
|
+
|
167
|
+
ActivePlan.prototype.dequeue = function () {
|
168
|
+
this.joinObservers.forEach(function (v) { v.queue.shift(); });
|
169
|
+
};
|
170
|
+
|
171
|
+
ActivePlan.prototype.match = function () {
|
172
|
+
var i, len, hasValues = true;
|
173
|
+
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
|
174
|
+
if (this.joinObserverArray[i].queue.length === 0) {
|
175
|
+
hasValues = false;
|
176
|
+
break;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
if (hasValues) {
|
180
|
+
var firstValues = [],
|
181
|
+
isCompleted = false;
|
182
|
+
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
|
183
|
+
firstValues.push(this.joinObserverArray[i].queue[0]);
|
184
|
+
this.joinObserverArray[i].queue[0].kind === 'C' && (isCompleted = true);
|
185
|
+
}
|
186
|
+
if (isCompleted) {
|
187
|
+
this.onCompleted();
|
188
|
+
} else {
|
189
|
+
this.dequeue();
|
190
|
+
var values = [];
|
191
|
+
for (i = 0, len = firstValues.length; i < firstValues.length; i++) {
|
192
|
+
values.push(firstValues[i].value);
|
193
|
+
}
|
194
|
+
this.onNext.apply(this, values);
|
195
|
+
}
|
196
|
+
}
|
197
|
+
};
|
198
|
+
|
199
|
+
var JoinObserver = (function (__super__) {
|
200
|
+
|
201
|
+
inherits(JoinObserver, __super__);
|
202
|
+
|
203
|
+
function JoinObserver(source, onError) {
|
204
|
+
__super__.call(this);
|
205
|
+
this.source = source;
|
206
|
+
this.onError = onError;
|
207
|
+
this.queue = [];
|
208
|
+
this.activePlans = [];
|
209
|
+
this.subscription = new SingleAssignmentDisposable();
|
210
|
+
this.isDisposed = false;
|
211
|
+
}
|
212
|
+
|
213
|
+
var JoinObserverPrototype = JoinObserver.prototype;
|
214
|
+
|
215
|
+
JoinObserverPrototype.next = function (notification) {
|
216
|
+
if (!this.isDisposed) {
|
217
|
+
if (notification.kind === 'E') {
|
218
|
+
this.onError(notification.exception);
|
219
|
+
return;
|
220
|
+
}
|
221
|
+
this.queue.push(notification);
|
222
|
+
var activePlans = this.activePlans.slice(0);
|
223
|
+
for (var i = 0, len = activePlans.length; i < len; i++) {
|
224
|
+
activePlans[i].match();
|
225
|
+
}
|
226
|
+
}
|
227
|
+
};
|
228
|
+
|
229
|
+
JoinObserverPrototype.error = noop;
|
230
|
+
JoinObserverPrototype.completed = noop;
|
231
|
+
|
232
|
+
JoinObserverPrototype.addActivePlan = function (activePlan) {
|
233
|
+
this.activePlans.push(activePlan);
|
234
|
+
};
|
235
|
+
|
236
|
+
JoinObserverPrototype.subscribe = function () {
|
237
|
+
this.subscription.setDisposable(this.source.materialize().subscribe(this));
|
238
|
+
};
|
239
|
+
|
240
|
+
JoinObserverPrototype.removeActivePlan = function (activePlan) {
|
241
|
+
this.activePlans.splice(this.activePlans.indexOf(activePlan), 1);
|
242
|
+
this.activePlans.length === 0 && this.dispose();
|
243
|
+
};
|
244
|
+
|
245
|
+
JoinObserverPrototype.dispose = function () {
|
246
|
+
__super__.prototype.dispose.call(this);
|
247
|
+
if (!this.isDisposed) {
|
248
|
+
this.isDisposed = true;
|
249
|
+
this.subscription.dispose();
|
250
|
+
}
|
251
|
+
};
|
252
|
+
|
253
|
+
return JoinObserver;
|
254
|
+
} (AbstractObserver));
|
346
255
|
|
347
256
|
/**
|
348
257
|
* Creates a pattern that matches when both observable sequences have an available value.
|
349
|
-
*
|
258
|
+
*
|
350
259
|
* @param right Observable sequence to match with the current sequence.
|
351
|
-
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
|
260
|
+
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
|
352
261
|
*/
|
353
262
|
observableProto.and = function (right) {
|
354
263
|
return new Pattern([this, right]);
|
@@ -356,60 +265,53 @@
|
|
356
265
|
|
357
266
|
/**
|
358
267
|
* Matches when the observable sequence has an available value and projects the value.
|
359
|
-
*
|
268
|
+
*
|
360
269
|
* @param selector Selector that will be invoked for values in the source sequence.
|
361
|
-
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
|
362
|
-
*/
|
270
|
+
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
|
271
|
+
*/
|
363
272
|
observableProto.thenDo = function (selector) {
|
364
273
|
return new Pattern([this]).thenDo(selector);
|
365
274
|
};
|
366
275
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
joinObserver = joinValues[i];
|
407
|
-
joinObserver.subscribe();
|
408
|
-
group.add(joinObserver);
|
409
|
-
}
|
410
|
-
return group;
|
411
|
-
});
|
412
|
-
};
|
276
|
+
/**
|
277
|
+
* Joins together the results from several patterns.
|
278
|
+
*
|
279
|
+
* @param plans A series of plans (specified as an Array of as a series of arguments) created by use of the Then operator on patterns.
|
280
|
+
* @returns {Observable} Observable sequence with the results form matching several patterns.
|
281
|
+
*/
|
282
|
+
Observable.when = function () {
|
283
|
+
var plans = argsOrArray(arguments, 0);
|
284
|
+
return new AnonymousObservable(function (observer) {
|
285
|
+
var activePlans = [],
|
286
|
+
externalSubscriptions = new Map();
|
287
|
+
var outObserver = observerCreate(
|
288
|
+
observer.onNext.bind(observer),
|
289
|
+
function (err) {
|
290
|
+
externalSubscriptions.forEach(function (v) { v.onError(err); });
|
291
|
+
observer.onError(err);
|
292
|
+
},
|
293
|
+
observer.onCompleted.bind(observer)
|
294
|
+
);
|
295
|
+
try {
|
296
|
+
for (var i = 0, len = plans.length; i < len; i++) {
|
297
|
+
activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) {
|
298
|
+
var idx = activePlans.indexOf(activePlan);
|
299
|
+
activePlans.splice(idx, 1);
|
300
|
+
activePlans.length === 0 && observer.onCompleted();
|
301
|
+
}));
|
302
|
+
}
|
303
|
+
} catch (e) {
|
304
|
+
observableThrow(e).subscribe(observer);
|
305
|
+
}
|
306
|
+
var group = new CompositeDisposable();
|
307
|
+
externalSubscriptions.forEach(function (joinObserver) {
|
308
|
+
joinObserver.subscribe();
|
309
|
+
group.add(joinObserver);
|
310
|
+
});
|
311
|
+
|
312
|
+
return group;
|
313
|
+
});
|
314
|
+
};
|
413
315
|
|
414
|
-
return Rx;
|
415
|
-
}));
|
316
|
+
return Rx;
|
317
|
+
}));
|