rxjs-rails 2.2.17 → 2.2.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Rakefile +19 -0
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.js +23 -23
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.compat.js +2 -2
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +2 -2
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.backpressure.js +2 -2
- data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
- data/vendor/assets/javascripts/rx.binding.js +85 -85
- data/vendor/assets/javascripts/rx.coincidence.js +17 -17
- data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +461 -456
- data/vendor/assets/javascripts/rx.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.experimental.js +31 -31
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
- data/vendor/assets/javascripts/rx.joinpatterns.js +284 -284
- data/vendor/assets/javascripts/rx.joinpatterns.min.js +1 -1
- data/vendor/assets/javascripts/rx.js +446 -441
- data/vendor/assets/javascripts/rx.lite.compat.js +469 -464
- data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.lite.js +469 -464
- 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 +165 -165
- data/vendor/assets/javascripts/rx.time.js +19 -19
- data/vendor/assets/javascripts/rx.time.min.js +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.js +2 -2
- metadata +3 -2
@@ -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,104 +33,104 @@
|
|
33
33
|
}
|
34
34
|
}.call(this, function (root, exp, Rx, undefined) {
|
35
35
|
|
36
|
-
// Aliases
|
37
|
-
var Observable = Rx.Observable,
|
38
|
-
observableProto = Observable.prototype,
|
39
|
-
AnonymousObservable = Rx.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
|
-
}());
|
36
|
+
// Aliases
|
37
|
+
var Observable = Rx.Observable,
|
38
|
+
observableProto = Observable.prototype,
|
39
|
+
AnonymousObservable = Rx.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
134
|
|
135
135
|
/**
|
136
136
|
* @constructor
|
@@ -162,190 +162,190 @@
|
|
162
162
|
return new Plan(this, selector);
|
163
163
|
};
|
164
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));
|
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
349
|
|
350
350
|
/**
|
351
351
|
* Creates a pattern that matches when both observable sequences have an available value.
|
@@ -414,5 +414,5 @@
|
|
414
414
|
});
|
415
415
|
};
|
416
416
|
|
417
|
-
return Rx;
|
417
|
+
return Rx;
|
418
418
|
}));
|
@@ -1 +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.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)
|
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.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 void b.onError(c)}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 void this.onError(a.exception);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});
|