rxjs-rails 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/LICENSE +19 -0
- data/README.md +14 -0
- data/lib/rxjs/rails/engine.rb +7 -0
- data/lib/rxjs/rails/railtie.rb +7 -0
- data/lib/rxjs/rails/version.rb +7 -0
- data/lib/rxjs/rails.rb +8 -0
- data/lib/rxjs.rb +1 -0
- data/rxjs-rails.gemspec +22 -0
- data/vendor/assets/javascripts/rx.aggregates.js +687 -0
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -0
- data/vendor/assets/javascripts/rx.async.compat.js +376 -0
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -0
- data/vendor/assets/javascripts/rx.async.js +306 -0
- data/vendor/assets/javascripts/rx.async.min.js +1 -0
- data/vendor/assets/javascripts/rx.binding.js +561 -0
- data/vendor/assets/javascripts/rx.binding.min.js +1 -0
- data/vendor/assets/javascripts/rx.coincidence.js +691 -0
- data/vendor/assets/javascripts/rx.coincidence.min.js +1 -0
- data/vendor/assets/javascripts/rx.compat.js +4351 -0
- data/vendor/assets/javascripts/rx.compat.min.js +2 -0
- data/vendor/assets/javascripts/rx.experimental.js +453 -0
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -0
- data/vendor/assets/javascripts/rx.joinpatterns.js +418 -0
- data/vendor/assets/javascripts/rx.joinpatterns.min.js +1 -0
- data/vendor/assets/javascripts/rx.lite.compat.js +5188 -0
- data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -0
- data/vendor/assets/javascripts/rx.lite.js +5000 -0
- data/vendor/assets/javascripts/rx.lite.min.js +2 -0
- data/vendor/assets/javascripts/rx.min.js +2 -0
- data/vendor/assets/javascripts/rx.node.js +143 -0
- data/vendor/assets/javascripts/rx.testing.js +503 -0
- data/vendor/assets/javascripts/rx.testing.min.js +1 -0
- data/vendor/assets/javascripts/rx.time.js +1166 -0
- data/vendor/assets/javascripts/rx.time.min.js +1 -0
- data/vendor/assets/javascripts/rx.virtualtime.js +336 -0
- data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -0
- metadata +101 -0
@@ -0,0 +1,418 @@
|
|
1
|
+
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
2
|
+
|
3
|
+
;(function (factory) {
|
4
|
+
var objectTypes = {
|
5
|
+
'boolean': false,
|
6
|
+
'function': true,
|
7
|
+
'object': true,
|
8
|
+
'number': false,
|
9
|
+
'string': false,
|
10
|
+
'undefined': false
|
11
|
+
};
|
12
|
+
|
13
|
+
var root = (objectTypes[typeof window] && window) || this,
|
14
|
+
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
|
15
|
+
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
|
16
|
+
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
|
17
|
+
freeGlobal = objectTypes[typeof global] && global;
|
18
|
+
|
19
|
+
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
|
20
|
+
root = freeGlobal;
|
21
|
+
}
|
22
|
+
|
23
|
+
// Because of build optimizers
|
24
|
+
if (typeof define === 'function' && define.amd) {
|
25
|
+
define(['rx', 'exports'], function (Rx, exports) {
|
26
|
+
root.Rx = factory(root, exports, Rx);
|
27
|
+
return root.Rx;
|
28
|
+
});
|
29
|
+
} else if (typeof module === 'object' && module && module.exports === freeExports) {
|
30
|
+
module.exports = factory(root, module.exports, require('./rx'));
|
31
|
+
} else {
|
32
|
+
root.Rx = factory(root, {}, root.Rx);
|
33
|
+
}
|
34
|
+
}.call(this, function (root, exp, Rx, undefined) {
|
35
|
+
|
36
|
+
// Aliases
|
37
|
+
var Observable = Rx.Observable,
|
38
|
+
observableProto = Observable.prototype,
|
39
|
+
AnonymousObservable = Rx.Internals.AnonymousObservable,
|
40
|
+
observableThrow = Observable.throwException,
|
41
|
+
observerCreate = Rx.Observer.create,
|
42
|
+
SingleAssignmentDisposable = Rx.SingleAssignmentDisposable,
|
43
|
+
CompositeDisposable = Rx.CompositeDisposable,
|
44
|
+
AbstractObserver = Rx.Internals.AbstractObserver,
|
45
|
+
isEqual = Rx.Internals.isEqual;
|
46
|
+
|
47
|
+
// Defaults
|
48
|
+
function defaultComparer(x, y) { return isEqual(x, y); }
|
49
|
+
function noop() { }
|
50
|
+
|
51
|
+
// Utilities
|
52
|
+
var inherits = Rx.Internals.inherits;
|
53
|
+
var slice = Array.prototype.slice;
|
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 = (function () {
|
62
|
+
|
63
|
+
/**
|
64
|
+
* @constructor
|
65
|
+
* @private
|
66
|
+
*/
|
67
|
+
function Map() {
|
68
|
+
this.keys = [];
|
69
|
+
this.values = [];
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* @private
|
74
|
+
* @memberOf Map#
|
75
|
+
*/
|
76
|
+
Map.prototype['delete'] = function (key) {
|
77
|
+
var i = this.keys.indexOf(key);
|
78
|
+
if (i !== -1) {
|
79
|
+
this.keys.splice(i, 1);
|
80
|
+
this.values.splice(i, 1);
|
81
|
+
}
|
82
|
+
return i !== -1;
|
83
|
+
};
|
84
|
+
|
85
|
+
/**
|
86
|
+
* @private
|
87
|
+
* @memberOf Map#
|
88
|
+
*/
|
89
|
+
Map.prototype.get = function (key, fallback) {
|
90
|
+
var i = this.keys.indexOf(key);
|
91
|
+
return i !== -1 ? this.values[i] : fallback;
|
92
|
+
};
|
93
|
+
|
94
|
+
/**
|
95
|
+
* @private
|
96
|
+
* @memberOf Map#
|
97
|
+
*/
|
98
|
+
Map.prototype.set = function (key, value) {
|
99
|
+
var i = this.keys.indexOf(key);
|
100
|
+
if (i !== -1) {
|
101
|
+
this.values[i] = value;
|
102
|
+
}
|
103
|
+
this.values[this.keys.push(key) - 1] = value;
|
104
|
+
};
|
105
|
+
|
106
|
+
/**
|
107
|
+
* @private
|
108
|
+
* @memberOf Map#
|
109
|
+
*/
|
110
|
+
Map.prototype.size = function () { return this.keys.length; };
|
111
|
+
|
112
|
+
/**
|
113
|
+
* @private
|
114
|
+
* @memberOf Map#
|
115
|
+
*/
|
116
|
+
Map.prototype.has = function (key) {
|
117
|
+
return this.keys.indexOf(key) !== -1;
|
118
|
+
};
|
119
|
+
|
120
|
+
/**
|
121
|
+
* @private
|
122
|
+
* @memberOf Map#
|
123
|
+
*/
|
124
|
+
Map.prototype.getKeys = function () { return this.keys.slice(0); };
|
125
|
+
|
126
|
+
/**
|
127
|
+
* @private
|
128
|
+
* @memberOf Map#
|
129
|
+
*/
|
130
|
+
Map.prototype.getValues = function () { return this.values.slice(0); };
|
131
|
+
|
132
|
+
return Map;
|
133
|
+
}());
|
134
|
+
|
135
|
+
/**
|
136
|
+
* @constructor
|
137
|
+
* Represents a join pattern over observable sequences.
|
138
|
+
*/
|
139
|
+
function Pattern(patterns) {
|
140
|
+
this.patterns = patterns;
|
141
|
+
}
|
142
|
+
|
143
|
+
/**
|
144
|
+
* Creates a pattern that matches the current plan matches and when the specified observable sequences has an available value.
|
145
|
+
*
|
146
|
+
* @param other Observable sequence to match in addition to the current pattern.
|
147
|
+
* @return Pattern object that matches when all observable sequences in the pattern have an available value.
|
148
|
+
*/
|
149
|
+
Pattern.prototype.and = function (other) {
|
150
|
+
var patterns = this.patterns.slice(0);
|
151
|
+
patterns.push(other);
|
152
|
+
return new Pattern(patterns);
|
153
|
+
};
|
154
|
+
|
155
|
+
/**
|
156
|
+
* Matches when all observable sequences in the pattern (specified using a chain of and operators) have an available value and projects the values.
|
157
|
+
*
|
158
|
+
* @param selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
|
159
|
+
* @return Plan that produces the projected values, to be fed (with other plans) to the when operator.
|
160
|
+
*/
|
161
|
+
Pattern.prototype.then = function (selector) {
|
162
|
+
return new Plan(this, selector);
|
163
|
+
};
|
164
|
+
|
165
|
+
function Plan(expression, selector) {
|
166
|
+
this.expression = expression;
|
167
|
+
this.selector = selector;
|
168
|
+
}
|
169
|
+
|
170
|
+
Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) {
|
171
|
+
var self = this;
|
172
|
+
var joinObservers = [];
|
173
|
+
for (var i = 0, len = this.expression.patterns.length; i < len; i++) {
|
174
|
+
joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], observer.onError.bind(observer)));
|
175
|
+
}
|
176
|
+
var activePlan = new ActivePlan(joinObservers, function () {
|
177
|
+
var result;
|
178
|
+
try {
|
179
|
+
result = self.selector.apply(self, arguments);
|
180
|
+
} catch (exception) {
|
181
|
+
observer.onError(exception);
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
observer.onNext(result);
|
185
|
+
}, function () {
|
186
|
+
for (var j = 0, jlen = joinObservers.length; j < jlen; j++) {
|
187
|
+
joinObservers[j].removeActivePlan(activePlan);
|
188
|
+
}
|
189
|
+
deactivate(activePlan);
|
190
|
+
});
|
191
|
+
for (i = 0, len = joinObservers.length; i < len; i++) {
|
192
|
+
joinObservers[i].addActivePlan(activePlan);
|
193
|
+
}
|
194
|
+
return activePlan;
|
195
|
+
};
|
196
|
+
|
197
|
+
function planCreateObserver(externalSubscriptions, observable, onError) {
|
198
|
+
var entry = externalSubscriptions.get(observable);
|
199
|
+
if (!entry) {
|
200
|
+
var observer = new JoinObserver(observable, onError);
|
201
|
+
externalSubscriptions.set(observable, observer);
|
202
|
+
return observer;
|
203
|
+
}
|
204
|
+
return entry;
|
205
|
+
}
|
206
|
+
|
207
|
+
// Active Plan
|
208
|
+
function ActivePlan(joinObserverArray, onNext, onCompleted) {
|
209
|
+
var i, joinObserver;
|
210
|
+
this.joinObserverArray = joinObserverArray;
|
211
|
+
this.onNext = onNext;
|
212
|
+
this.onCompleted = onCompleted;
|
213
|
+
this.joinObservers = new Map();
|
214
|
+
for (i = 0; i < this.joinObserverArray.length; i++) {
|
215
|
+
joinObserver = this.joinObserverArray[i];
|
216
|
+
this.joinObservers.set(joinObserver, joinObserver);
|
217
|
+
}
|
218
|
+
}
|
219
|
+
|
220
|
+
ActivePlan.prototype.dequeue = function () {
|
221
|
+
var values = this.joinObservers.getValues();
|
222
|
+
for (var i = 0, len = values.length; i < len; i++) {
|
223
|
+
values[i].queue.shift();
|
224
|
+
}
|
225
|
+
};
|
226
|
+
ActivePlan.prototype.match = function () {
|
227
|
+
var firstValues, i, len, isCompleted, values, hasValues = true;
|
228
|
+
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
|
229
|
+
if (this.joinObserverArray[i].queue.length === 0) {
|
230
|
+
hasValues = false;
|
231
|
+
break;
|
232
|
+
}
|
233
|
+
}
|
234
|
+
if (hasValues) {
|
235
|
+
firstValues = [];
|
236
|
+
isCompleted = false;
|
237
|
+
for (i = 0, len = this.joinObserverArray.length; i < len; i++) {
|
238
|
+
firstValues.push(this.joinObserverArray[i].queue[0]);
|
239
|
+
if (this.joinObserverArray[i].queue[0].kind === 'C') {
|
240
|
+
isCompleted = true;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
if (isCompleted) {
|
244
|
+
this.onCompleted();
|
245
|
+
} else {
|
246
|
+
this.dequeue();
|
247
|
+
values = [];
|
248
|
+
for (i = 0; i < firstValues.length; i++) {
|
249
|
+
values.push(firstValues[i].value);
|
250
|
+
}
|
251
|
+
this.onNext.apply(this, values);
|
252
|
+
}
|
253
|
+
}
|
254
|
+
};
|
255
|
+
|
256
|
+
/** @private */
|
257
|
+
var JoinObserver = (function (_super) {
|
258
|
+
|
259
|
+
inherits(JoinObserver, _super);
|
260
|
+
|
261
|
+
/**
|
262
|
+
* @constructor
|
263
|
+
* @private
|
264
|
+
*/
|
265
|
+
function JoinObserver(source, onError) {
|
266
|
+
_super.call(this);
|
267
|
+
this.source = source;
|
268
|
+
this.onError = onError;
|
269
|
+
this.queue = [];
|
270
|
+
this.activePlans = [];
|
271
|
+
this.subscription = new SingleAssignmentDisposable();
|
272
|
+
this.isDisposed = false;
|
273
|
+
}
|
274
|
+
|
275
|
+
var JoinObserverPrototype = JoinObserver.prototype;
|
276
|
+
|
277
|
+
/**
|
278
|
+
* @memberOf JoinObserver#
|
279
|
+
* @private
|
280
|
+
*/
|
281
|
+
JoinObserverPrototype.next = function (notification) {
|
282
|
+
if (!this.isDisposed) {
|
283
|
+
if (notification.kind === 'E') {
|
284
|
+
this.onError(notification.exception);
|
285
|
+
return;
|
286
|
+
}
|
287
|
+
this.queue.push(notification);
|
288
|
+
var activePlans = this.activePlans.slice(0);
|
289
|
+
for (var i = 0, len = activePlans.length; i < len; i++) {
|
290
|
+
activePlans[i].match();
|
291
|
+
}
|
292
|
+
}
|
293
|
+
};
|
294
|
+
|
295
|
+
/**
|
296
|
+
* @memberOf JoinObserver#
|
297
|
+
* @private
|
298
|
+
*/
|
299
|
+
JoinObserverPrototype.error = noop;
|
300
|
+
|
301
|
+
/**
|
302
|
+
* @memberOf JoinObserver#
|
303
|
+
* @private
|
304
|
+
*/
|
305
|
+
JoinObserverPrototype.completed = noop;
|
306
|
+
|
307
|
+
/**
|
308
|
+
* @memberOf JoinObserver#
|
309
|
+
* @private
|
310
|
+
*/
|
311
|
+
JoinObserverPrototype.addActivePlan = function (activePlan) {
|
312
|
+
this.activePlans.push(activePlan);
|
313
|
+
};
|
314
|
+
|
315
|
+
/**
|
316
|
+
* @memberOf JoinObserver#
|
317
|
+
* @private
|
318
|
+
*/
|
319
|
+
JoinObserverPrototype.subscribe = function () {
|
320
|
+
this.subscription.setDisposable(this.source.materialize().subscribe(this));
|
321
|
+
};
|
322
|
+
|
323
|
+
/**
|
324
|
+
* @memberOf JoinObserver#
|
325
|
+
* @private
|
326
|
+
*/
|
327
|
+
JoinObserverPrototype.removeActivePlan = function (activePlan) {
|
328
|
+
var idx = this.activePlans.indexOf(activePlan);
|
329
|
+
this.activePlans.splice(idx, 1);
|
330
|
+
if (this.activePlans.length === 0) {
|
331
|
+
this.dispose();
|
332
|
+
}
|
333
|
+
};
|
334
|
+
|
335
|
+
/**
|
336
|
+
* @memberOf JoinObserver#
|
337
|
+
* @private
|
338
|
+
*/
|
339
|
+
JoinObserverPrototype.dispose = function () {
|
340
|
+
_super.prototype.dispose.call(this);
|
341
|
+
if (!this.isDisposed) {
|
342
|
+
this.isDisposed = true;
|
343
|
+
this.subscription.dispose();
|
344
|
+
}
|
345
|
+
};
|
346
|
+
|
347
|
+
return JoinObserver;
|
348
|
+
} (AbstractObserver));
|
349
|
+
|
350
|
+
/**
|
351
|
+
* Creates a pattern that matches when both observable sequences have an available value.
|
352
|
+
*
|
353
|
+
* @param right Observable sequence to match with the current sequence.
|
354
|
+
* @return {Pattern} Pattern object that matches when both observable sequences have an available value.
|
355
|
+
*/
|
356
|
+
observableProto.and = function (right) {
|
357
|
+
return new Pattern([this, right]);
|
358
|
+
};
|
359
|
+
|
360
|
+
/**
|
361
|
+
* Matches when the observable sequence has an available value and projects the value.
|
362
|
+
*
|
363
|
+
* @param selector Selector that will be invoked for values in the source sequence.
|
364
|
+
* @returns {Plan} Plan that produces the projected values, to be fed (with other plans) to the when operator.
|
365
|
+
*/
|
366
|
+
observableProto.then = function (selector) {
|
367
|
+
return new Pattern([this]).then(selector);
|
368
|
+
};
|
369
|
+
|
370
|
+
/**
|
371
|
+
* Joins together the results from several patterns.
|
372
|
+
*
|
373
|
+
* @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.
|
374
|
+
* @returns {Observable} Observable sequence with the results form matching several patterns.
|
375
|
+
*/
|
376
|
+
Observable.when = function () {
|
377
|
+
var plans = argsOrArray(arguments, 0);
|
378
|
+
return new AnonymousObservable(function (observer) {
|
379
|
+
var activePlans = [],
|
380
|
+
externalSubscriptions = new Map(),
|
381
|
+
group,
|
382
|
+
i, len,
|
383
|
+
joinObserver,
|
384
|
+
joinValues,
|
385
|
+
outObserver;
|
386
|
+
outObserver = observerCreate(observer.onNext.bind(observer), function (exception) {
|
387
|
+
var values = externalSubscriptions.getValues();
|
388
|
+
for (var j = 0, jlen = values.length; j < jlen; j++) {
|
389
|
+
values[j].onError(exception);
|
390
|
+
}
|
391
|
+
observer.onError(exception);
|
392
|
+
}, observer.onCompleted.bind(observer));
|
393
|
+
try {
|
394
|
+
for (i = 0, len = plans.length; i < len; i++) {
|
395
|
+
activePlans.push(plans[i].activate(externalSubscriptions, outObserver, function (activePlan) {
|
396
|
+
var idx = activePlans.indexOf(activePlan);
|
397
|
+
activePlans.splice(idx, 1);
|
398
|
+
if (activePlans.length === 0) {
|
399
|
+
outObserver.onCompleted();
|
400
|
+
}
|
401
|
+
}));
|
402
|
+
}
|
403
|
+
} catch (e) {
|
404
|
+
observableThrow(e).subscribe(observer);
|
405
|
+
}
|
406
|
+
group = new CompositeDisposable();
|
407
|
+
joinValues = externalSubscriptions.getValues();
|
408
|
+
for (i = 0, len = joinValues.length; i < len; i++) {
|
409
|
+
joinObserver = joinValues[i];
|
410
|
+
joinObserver.subscribe();
|
411
|
+
group.add(joinObserver);
|
412
|
+
}
|
413
|
+
return group;
|
414
|
+
});
|
415
|
+
};
|
416
|
+
|
417
|
+
return Rx;
|
418
|
+
}));
|
@@ -0,0 +1 @@
|
|
1
|
+
(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","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")):c.Rx=a(c,{},c.Rx)}).call(this,function(a,b,c){function d(){}function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:s.call(a)}function f(a){this.patterns=a}function g(a,b){this.expression=a,this.selector=b}function h(a,b,c){var d=a.get(b);if(!d){var e=new u(b,c);return a.set(b,e),e}return d}function i(a,b,c){var d,e;for(this.joinObserverArray=a,this.onNext=b,this.onCompleted=c,this.joinObservers=new t,d=0;d<this.joinObserverArray.length;d++)e=this.joinObserverArray[d],this.joinObservers.set(e,e)}var j=c.Observable,k=j.prototype,l=c.Internals.AnonymousObservable,m=j.throwException,n=c.Observer.create,o=c.SingleAssignmentDisposable,p=c.CompositeDisposable,q=c.Internals.AbstractObserver,r=(c.Internals.isEqual,c.Internals.inherits),s=Array.prototype.slice,t=function(){function a(){this.keys=[],this.values=[]}return a.prototype["delete"]=function(a){var b=this.keys.indexOf(a);return-1!==b&&(this.keys.splice(b,1),this.values.splice(b,1)),-1!==b},a.prototype.get=function(a,b){var c=this.keys.indexOf(a);return-1!==c?this.values[c]:b},a.prototype.set=function(a,b){var c=this.keys.indexOf(a);-1!==c&&(this.values[c]=b),this.values[this.keys.push(a)-1]=b},a.prototype.size=function(){return this.keys.length},a.prototype.has=function(a){return-1!==this.keys.indexOf(a)},a.prototype.getKeys=function(){return this.keys.slice(0)},a.prototype.getValues=function(){return this.values.slice(0)},a}();f.prototype.and=function(a){var b=this.patterns.slice(0);return b.push(a),new f(b)},f.prototype.then=function(a){return new g(this,a)},g.prototype.activate=function(a,b,c){for(var d=this,e=[],f=0,g=this.expression.patterns.length;g>f;f++)e.push(h(a,this.expression.patterns[f],b.onError.bind(b)));var j=new i(e,function(){var a;try{a=d.selector.apply(d,arguments)}catch(c){return b.onError(c),void 0}b.onNext(a)},function(){for(var a=0,b=e.length;b>a;a++)e[a].removeActivePlan(j);c(j)});for(f=0,g=e.length;g>f;f++)e[f].addActivePlan(j);return j},i.prototype.dequeue=function(){for(var a=this.joinObservers.getValues(),b=0,c=a.length;c>b;b++)a[b].queue.shift()},i.prototype.match=function(){var a,b,c,d,e,f=!0;for(b=0,c=this.joinObserverArray.length;c>b;b++)if(0===this.joinObserverArray[b].queue.length){f=!1;break}if(f){for(a=[],d=!1,b=0,c=this.joinObserverArray.length;c>b;b++)a.push(this.joinObserverArray[b].queue[0]),"C"===this.joinObserverArray[b].queue[0].kind&&(d=!0);if(d)this.onCompleted();else{for(this.dequeue(),e=[],b=0;b<a.length;b++)e.push(a[b].value);this.onNext.apply(this,e)}}};var u=function(a){function b(b,c){a.call(this),this.source=b,this.onError=c,this.queue=[],this.activePlans=[],this.subscription=new o,this.isDisposed=!1}r(b,a);var c=b.prototype;return c.next=function(a){if(!this.isDisposed){if("E"===a.kind)return this.onError(a.exception),void 0;this.queue.push(a);for(var b=this.activePlans.slice(0),c=0,d=b.length;d>c;c++)b[c].match()}},c.error=d,c.completed=d,c.addActivePlan=function(a){this.activePlans.push(a)},c.subscribe=function(){this.subscription.setDisposable(this.source.materialize().subscribe(this))},c.removeActivePlan=function(a){var b=this.activePlans.indexOf(a);this.activePlans.splice(b,1),0===this.activePlans.length&&this.dispose()},c.dispose=function(){a.prototype.dispose.call(this),this.isDisposed||(this.isDisposed=!0,this.subscription.dispose())},b}(q);return k.and=function(a){return new f([this,a])},k.then=function(a){return new f([this]).then(a)},j.when=function(){var a=e(arguments,0);return new l(function(b){var c,d,e,f,g,h,i=[],j=new t;h=n(b.onNext.bind(b),function(a){for(var c=j.getValues(),d=0,e=c.length;e>d;d++)c[d].onError(a);b.onError(a)},b.onCompleted.bind(b));try{for(d=0,e=a.length;e>d;d++)i.push(a[d].activate(j,h,function(a){var b=i.indexOf(a);i.splice(b,1),0===i.length&&h.onCompleted()}))}catch(k){m(k).subscribe(b)}for(c=new p,g=j.getValues(),d=0,e=g.length;e>d;d++)f=g[d],f.subscribe(),c.add(f);return c})},c});
|