rxjs-rails 2.2.27 → 2.3.0
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 +4 -4
- data/Rakefile +0 -3
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.all.compat.js +1545 -1441
- data/vendor/assets/javascripts/rx.all.compat.min.js +3 -3
- data/vendor/assets/javascripts/rx.all.js +1545 -1441
- data/vendor/assets/javascripts/rx.all.min.js +3 -3
- data/vendor/assets/javascripts/rx.async.compat.js +149 -152
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +140 -143
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.backpressure.min.js +1 -1
- data/vendor/assets/javascripts/rx.binding.js +18 -18
- data/vendor/assets/javascripts/rx.binding.min.js +1 -1
- data/vendor/assets/javascripts/rx.coincidence.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +490 -339
- data/vendor/assets/javascripts/rx.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.core.compat.js +109 -141
- data/vendor/assets/javascripts/rx.core.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.core.js +109 -141
- data/vendor/assets/javascripts/rx.core.min.js +1 -1
- data/vendor/assets/javascripts/rx.experimental.js +129 -136
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
- data/vendor/assets/javascripts/rx.joinpatterns.js +59 -59
- data/vendor/assets/javascripts/rx.joinpatterns.min.js +1 -1
- data/vendor/assets/javascripts/rx.js +490 -339
- data/vendor/assets/javascripts/rx.lite.compat.js +1099 -954
- data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.lite.extras.min.js +1 -1
- data/vendor/assets/javascripts/rx.lite.js +1099 -954
- 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.min.js +1 -1
- data/vendor/assets/javascripts/rx.time.js +715 -747
- data/vendor/assets/javascripts/rx.time.min.js +1 -1
- data/vendor/assets/javascripts/rx.virtualtime.min.js +1 -1
- metadata +11 -10
@@ -54,8 +54,10 @@
|
|
54
54
|
Observer = Rx.Observer,
|
55
55
|
inherits = Rx.internals.inherits,
|
56
56
|
addProperties = Rx.internals.addProperties,
|
57
|
-
|
58
|
-
|
57
|
+
helpers = Rx.helpers,
|
58
|
+
noop = helpers.noop,
|
59
|
+
isPromise = helpers.isPromise,
|
60
|
+
isScheduler = helpers.isScheduler,
|
59
61
|
observableFromPromise = Observable.fromPromise;
|
60
62
|
|
61
63
|
// Utilities
|
@@ -66,14 +68,13 @@
|
|
66
68
|
}
|
67
69
|
|
68
70
|
// Shim in iterator support
|
69
|
-
var $iterator$ = (typeof Symbol === '
|
71
|
+
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
|
70
72
|
'_es6shim_iterator_';
|
71
|
-
//
|
72
|
-
// https://bugzilla.mozilla.org/show_bug.cgi?id=907077#c14
|
73
|
-
// So use that name if we detect it.
|
73
|
+
// Bug for mozilla version
|
74
74
|
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
|
75
75
|
$iterator$ = '@@iterator';
|
76
76
|
}
|
77
|
+
|
77
78
|
var doneEnumerator = { done: true, value: undefined };
|
78
79
|
|
79
80
|
function enumerableWhile(condition, source) {
|
@@ -174,6 +175,7 @@
|
|
174
175
|
*/
|
175
176
|
Observable['case'] = Observable.switchCase = function (selector, sources, defaultSourceOrScheduler) {
|
176
177
|
return observableDefer(function () {
|
178
|
+
isPromise(defaultSourceOrScheduler) && (defaultSourceOrScheduler = observableFromPromise(defaultSourceOrScheduler));
|
177
179
|
defaultSourceOrScheduler || (defaultSourceOrScheduler = observableEmpty());
|
178
180
|
|
179
181
|
typeof defaultSourceOrScheduler.now === 'function' && (defaultSourceOrScheduler = observableEmpty(defaultSourceOrScheduler));
|
@@ -185,69 +187,69 @@
|
|
185
187
|
});
|
186
188
|
};
|
187
189
|
|
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
|
-
|
190
|
+
/**
|
191
|
+
* Expands an observable sequence by recursively invoking selector.
|
192
|
+
*
|
193
|
+
* @param {Function} selector Selector function to invoke for each produced element, resulting in another sequence to which the selector will be invoked recursively again.
|
194
|
+
* @param {Scheduler} [scheduler] Scheduler on which to perform the expansion. If not provided, this defaults to the current thread scheduler.
|
195
|
+
* @returns {Observable} An observable sequence containing all the elements produced by the recursive expansion.
|
196
|
+
*/
|
197
|
+
observableProto.expand = function (selector, scheduler) {
|
198
|
+
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
199
|
+
var source = this;
|
200
|
+
return new AnonymousObservable(function (observer) {
|
201
|
+
var q = [],
|
202
|
+
m = new SerialDisposable(),
|
203
|
+
d = new CompositeDisposable(m),
|
204
|
+
activeCount = 0,
|
205
|
+
isAcquired = false;
|
206
|
+
|
207
|
+
var ensureActive = function () {
|
208
|
+
var isOwner = false;
|
209
|
+
if (q.length > 0) {
|
210
|
+
isOwner = !isAcquired;
|
211
|
+
isAcquired = true;
|
212
|
+
}
|
213
|
+
if (isOwner) {
|
214
|
+
m.setDisposable(scheduler.scheduleRecursive(function (self) {
|
215
|
+
var work;
|
216
|
+
if (q.length > 0) {
|
217
|
+
work = q.shift();
|
218
|
+
} else {
|
219
|
+
isAcquired = false;
|
220
|
+
return;
|
221
|
+
}
|
222
|
+
var m1 = new SingleAssignmentDisposable();
|
223
|
+
d.add(m1);
|
224
|
+
m1.setDisposable(work.subscribe(function (x) {
|
225
|
+
observer.onNext(x);
|
226
|
+
var result = null;
|
227
|
+
try {
|
228
|
+
result = selector(x);
|
229
|
+
} catch (e) {
|
230
|
+
observer.onError(e);
|
231
|
+
}
|
232
|
+
q.push(result);
|
233
|
+
activeCount++;
|
234
|
+
ensureActive();
|
235
|
+
}, observer.onError.bind(observer), function () {
|
236
|
+
d.remove(m1);
|
237
|
+
activeCount--;
|
238
|
+
if (activeCount === 0) {
|
239
|
+
observer.onCompleted();
|
240
|
+
}
|
241
|
+
}));
|
242
|
+
self();
|
243
|
+
}));
|
244
|
+
}
|
245
|
+
};
|
244
246
|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
247
|
+
q.push(source);
|
248
|
+
activeCount++;
|
249
|
+
ensureActive();
|
250
|
+
return d;
|
251
|
+
});
|
252
|
+
};
|
251
253
|
|
252
254
|
/**
|
253
255
|
* Runs all observable sequences in parallel and collect their last elements.
|
@@ -390,82 +392,73 @@
|
|
390
392
|
});
|
391
393
|
};
|
392
394
|
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
return source
|
406
|
-
.select(
|
407
|
-
function (x) {
|
408
|
-
var curr = new ChainObservable(x);
|
409
|
-
if (chain) {
|
410
|
-
chain.onNext(x);
|
411
|
-
}
|
412
|
-
chain = curr;
|
413
|
-
|
414
|
-
return curr;
|
415
|
-
})
|
416
|
-
.doAction(
|
417
|
-
noop,
|
418
|
-
function (e) {
|
419
|
-
if (chain) {
|
420
|
-
chain.onError(e);
|
421
|
-
}
|
422
|
-
},
|
423
|
-
function () {
|
424
|
-
if (chain) {
|
425
|
-
chain.onCompleted();
|
426
|
-
}
|
427
|
-
})
|
428
|
-
.observeOn(scheduler)
|
429
|
-
.select(function (x, i, o) { return selector(x, i, o); });
|
430
|
-
});
|
431
|
-
};
|
395
|
+
/**
|
396
|
+
* Comonadic bind operator.
|
397
|
+
* @param {Function} selector A transform function to apply to each element.
|
398
|
+
* @param {Object} scheduler Scheduler used to execute the operation. If not specified, defaults to the ImmediateScheduler.
|
399
|
+
* @returns {Observable} An observable sequence which results from the comonadic bind operation.
|
400
|
+
*/
|
401
|
+
observableProto.manySelect = function (selector, scheduler) {
|
402
|
+
isScheduler(scheduler) || (scheduler = immediateScheduler);
|
403
|
+
var source = this;
|
404
|
+
return observableDefer(function () {
|
405
|
+
var chain;
|
432
406
|
|
433
|
-
|
407
|
+
return source
|
408
|
+
.map(function (x) {
|
409
|
+
var curr = new ChainObservable(x);
|
434
410
|
|
435
|
-
|
436
|
-
|
437
|
-
g.add(currentThreadScheduler.schedule(function () {
|
438
|
-
observer.onNext(self.head);
|
439
|
-
g.add(self.tail.mergeObservable().subscribe(observer));
|
440
|
-
}));
|
411
|
+
chain && chain.onNext(x);
|
412
|
+
chain = curr;
|
441
413
|
|
442
|
-
|
443
|
-
}
|
414
|
+
return curr;
|
415
|
+
})
|
416
|
+
.doAction(
|
417
|
+
noop,
|
418
|
+
function (e) { chain && chain.onError(e); },
|
419
|
+
function () { chain && chain.onCompleted(); }
|
420
|
+
)
|
421
|
+
.observeOn(scheduler)
|
422
|
+
.map(selector);
|
423
|
+
});
|
424
|
+
};
|
444
425
|
|
445
|
-
|
426
|
+
var ChainObservable = (function (__super__) {
|
446
427
|
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
428
|
+
function subscribe (observer) {
|
429
|
+
var self = this, g = new CompositeDisposable();
|
430
|
+
g.add(currentThreadScheduler.schedule(function () {
|
431
|
+
observer.onNext(self.head);
|
432
|
+
g.add(self.tail.mergeObservable().subscribe(observer));
|
433
|
+
}));
|
452
434
|
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
435
|
+
return g;
|
436
|
+
}
|
437
|
+
|
438
|
+
inherits(ChainObservable, __super__);
|
439
|
+
|
440
|
+
function ChainObservable(head) {
|
441
|
+
__super__.call(this, subscribe);
|
442
|
+
this.head = head;
|
443
|
+
this.tail = new AsyncSubject();
|
444
|
+
}
|
445
|
+
|
446
|
+
addProperties(ChainObservable.prototype, Observer, {
|
447
|
+
onCompleted: function () {
|
448
|
+
this.onNext(Observable.empty());
|
449
|
+
},
|
450
|
+
onError: function (e) {
|
451
|
+
this.onNext(Observable.throwException(e));
|
452
|
+
},
|
453
|
+
onNext: function (v) {
|
454
|
+
this.tail.onNext(v);
|
455
|
+
this.tail.onCompleted();
|
456
|
+
}
|
457
|
+
});
|
465
458
|
|
466
|
-
|
459
|
+
return ChainObservable;
|
467
460
|
|
468
|
-
|
461
|
+
}(Observable));
|
469
462
|
|
470
463
|
return Rx;
|
471
464
|
}));
|
@@ -1 +1 @@
|
|
1
|
-
(function(
|
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,d){function e(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:v.call(a)}function f(a,b){return new r(function(){return new q(function(){return a()?{done:!1,value:b}:{done:!0,value:d}})})}var g=c.Observable,h=g.prototype,i=c.AnonymousObservable,j=g.concat,k=g.defer,l=g.empty,m=c.Disposable.empty,n=c.CompositeDisposable,o=c.SerialDisposable,p=c.SingleAssignmentDisposable,q=c.internals.Enumerator,r=c.internals.Enumerable,s=r.forEach,t=c.Scheduler.immediate,u=c.Scheduler.currentThread,v=Array.prototype.slice,w=c.AsyncSubject,x=c.Observer,y=c.internals.inherits,z=c.internals.addProperties,A=c.helpers,B=A.noop,C=A.isPromise,D=A.isScheduler,E=g.fromPromise,F="function"==typeof Symbol&&Symbol.iterator||"_es6shim_iterator_";a.Set&&"function"==typeof(new a.Set)["@@iterator"]&&(F="@@iterator");h.letBind=h.let=function(a){return a(this)},g["if"]=g.ifThen=function(a,b,c){return k(function(){return c||(c=l()),C(b)&&(b=E(b)),C(c)&&(c=E(c)),"function"==typeof c.now&&(c=l(c)),a()?b:c})},g["for"]=g.forIn=function(a,b){return s(a,b).concat()};var G=g["while"]=g.whileDo=function(a,b){return C(b)&&(b=E(b)),f(a,b).concat()};h.doWhile=function(a){return j([this,G(a,this)])},g["case"]=g.switchCase=function(a,b,c){return k(function(){C(c)&&(c=E(c)),c||(c=l()),"function"==typeof c.now&&(c=l(c));var d=b[a()];return C(d)&&(d=E(d)),d||c})},h.expand=function(a,b){D(b)||(b=t);var c=this;return new i(function(d){var e=[],f=new o,g=new n(f),h=0,i=!1,j=function(){var c=!1;e.length>0&&(c=!i,i=!0),c&&f.setDisposable(b.scheduleRecursive(function(b){var c;if(!(e.length>0))return void(i=!1);c=e.shift();var f=new p;g.add(f),f.setDisposable(c.subscribe(function(b){d.onNext(b);var c=null;try{c=a(b)}catch(f){d.onError(f)}e.push(c),h++,j()},d.onError.bind(d),function(){g.remove(f),h--,0===h&&d.onCompleted()})),b()}))};return e.push(c),h++,j(),g})},g.forkJoin=function(){var a=e(arguments,0);return new i(function(b){var c=a.length;if(0===c)return b.onCompleted(),m;for(var d=new n,e=!1,f=new Array(c),g=new Array(c),h=new Array(c),i=0;c>i;i++)!function(i){var j=a[i];C(j)&&(j=E(j)),d.add(j.subscribe(function(a){e||(f[i]=!0,h[i]=a)},function(a){e=!0,b.onError(a),d.dispose()},function(){if(!e){if(!f[i])return void b.onCompleted();g[i]=!0;for(var a=0;c>a;a++)if(!g[a])return;e=!0,b.onNext(h),b.onCompleted()}}))}(i);return d})},h.forkJoin=function(a,b){var c=this;return new i(function(d){var e,f,g=!1,h=!1,i=!1,j=!1,k=new p,l=new p;return C(a)&&(a=E(a)),k.setDisposable(c.subscribe(function(a){i=!0,e=a},function(a){l.dispose(),d.onError(a)},function(){if(g=!0,h)if(i)if(j){var a;try{a=b(e,f)}catch(c){return void d.onError(c)}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),l.setDisposable(a.subscribe(function(a){j=!0,f=a},function(a){k.dispose(),d.onError(a)},function(){if(h=!0,g)if(i)if(j){var a;try{a=b(e,f)}catch(c){return void d.onError(c)}d.onNext(a),d.onCompleted()}else d.onCompleted();else d.onCompleted()})),new n(k,l)})},h.manySelect=function(a,b){D(b)||(b=t);var c=this;return k(function(){var d;return c.map(function(a){var b=new H(a);return d&&d.onNext(a),d=b,b}).doAction(B,function(a){d&&d.onError(a)},function(){d&&d.onCompleted()}).observeOn(b).map(a)})};var H=function(a){function b(a){var b=this,c=new n;return c.add(u.schedule(function(){a.onNext(b.head),c.add(b.tail.mergeObservable().subscribe(a))})),c}function c(c){a.call(this,b),this.head=c,this.tail=new w}return y(c,a),z(c.prototype,x,{onCompleted:function(){this.onNext(g.empty())},onError:function(a){this.onNext(g.throwException(a))},onNext:function(a){this.tail.onNext(a),this.tail.onCompleted()}}),c}(g);return c});
|
@@ -155,51 +155,51 @@
|
|
155
155
|
* @param selector Selector that will be invoked with available values from the source sequences, in the same order of the sequences in the pattern.
|
156
156
|
* @return Plan that produces the projected values, to be fed (with other plans) to the when operator.
|
157
157
|
*/
|
158
|
-
Pattern.prototype.
|
158
|
+
Pattern.prototype.thenDo = function (selector) {
|
159
159
|
return new Plan(this, selector);
|
160
160
|
};
|
161
161
|
|
162
|
-
|
163
|
-
|
164
|
-
|
162
|
+
function Plan(expression, selector) {
|
163
|
+
this.expression = expression;
|
164
|
+
this.selector = selector;
|
165
|
+
}
|
166
|
+
|
167
|
+
Plan.prototype.activate = function (externalSubscriptions, observer, deactivate) {
|
168
|
+
var self = this;
|
169
|
+
var joinObservers = [];
|
170
|
+
for (var i = 0, len = this.expression.patterns.length; i < len; i++) {
|
171
|
+
joinObservers.push(planCreateObserver(externalSubscriptions, this.expression.patterns[i], observer.onError.bind(observer)));
|
165
172
|
}
|
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
|
-
function planCreateObserver(externalSubscriptions, observable, onError) {
|
195
|
-
var entry = externalSubscriptions.get(observable);
|
196
|
-
if (!entry) {
|
197
|
-
var observer = new JoinObserver(observable, onError);
|
198
|
-
externalSubscriptions.set(observable, observer);
|
199
|
-
return observer;
|
200
|
-
}
|
201
|
-
return entry;
|
173
|
+
var activePlan = new ActivePlan(joinObservers, function () {
|
174
|
+
var result;
|
175
|
+
try {
|
176
|
+
result = self.selector.apply(self, arguments);
|
177
|
+
} catch (exception) {
|
178
|
+
observer.onError(exception);
|
179
|
+
return;
|
180
|
+
}
|
181
|
+
observer.onNext(result);
|
182
|
+
}, function () {
|
183
|
+
for (var j = 0, jlen = joinObservers.length; j < jlen; j++) {
|
184
|
+
joinObservers[j].removeActivePlan(activePlan);
|
185
|
+
}
|
186
|
+
deactivate(activePlan);
|
187
|
+
});
|
188
|
+
for (i = 0, len = joinObservers.length; i < len; i++) {
|
189
|
+
joinObservers[i].addActivePlan(activePlan);
|
190
|
+
}
|
191
|
+
return activePlan;
|
192
|
+
};
|
193
|
+
|
194
|
+
function planCreateObserver(externalSubscriptions, observable, onError) {
|
195
|
+
var entry = externalSubscriptions.get(observable);
|
196
|
+
if (!entry) {
|
197
|
+
var observer = new JoinObserver(observable, onError);
|
198
|
+
externalSubscriptions.set(observable, observer);
|
199
|
+
return observer;
|
202
200
|
}
|
201
|
+
return entry;
|
202
|
+
}
|
203
203
|
|
204
204
|
// Active Plan
|
205
205
|
function ActivePlan(joinObserverArray, onNext, onCompleted) {
|
@@ -344,25 +344,25 @@
|
|
344
344
|
return JoinObserver;
|
345
345
|
} (AbstractObserver));
|
346
346
|
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
347
|
+
/**
|
348
|
+
* Creates a pattern that matches when both observable sequences have an available value.
|
349
|
+
*
|
350
|
+
* @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.
|
352
|
+
*/
|
353
|
+
observableProto.and = function (right) {
|
354
|
+
return new Pattern([this, right]);
|
355
|
+
};
|
356
|
+
|
357
|
+
/**
|
358
|
+
* Matches when the observable sequence has an available value and projects the value.
|
359
|
+
*
|
360
|
+
* @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
|
+
*/
|
363
|
+
observableProto.thenDo = function (selector) {
|
364
|
+
return new Pattern([this]).thenDo(selector);
|
365
|
+
};
|
366
366
|
|
367
367
|
/**
|
368
368
|
* Joins together the results from several patterns.
|
@@ -1 +1 @@
|
|
1
|
-
(function(
|
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(a,b){return 1===a.length&&Array.isArray(a[b])?a[b]:s.call(a)}function e(a){this.patterns=a}function f(a,b){this.expression=a,this.selector=b}function g(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 h(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 i=c.Observable,j=i.prototype,k=c.AnonymousObservable,l=i.throwException,m=c.Observer.create,n=c.SingleAssignmentDisposable,o=c.CompositeDisposable,p=c.internals.AbstractObserver,q=c.helpers.noop,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}();e.prototype.and=function(a){var b=this.patterns.slice(0);return b.push(a),new e(b)},e.prototype.thenDo=function(a){return new f(this,a)},f.prototype.activate=function(a,b,c){for(var d=this,e=[],f=0,i=this.expression.patterns.length;i>f;f++)e.push(g(a,this.expression.patterns[f],b.onError.bind(b)));var j=new h(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,i=e.length;i>f;f++)e[f].addActivePlan(j);return j},h.prototype.dequeue=function(){for(var a=this.joinObservers.getValues(),b=0,c=a.length;c>b;b++)a[b].queue.shift()},h.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 n,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=q,c.completed=q,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}(p);return j.and=function(a){return new e([this,a])},j.thenDo=function(a){return new e([this]).thenDo(a)},i.when=function(){var a=d(arguments,0);return new k(function(b){var c,d,e,f,g,h,i=[],j=new t;h=m(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){l(k).subscribe(b)}for(c=new o,g=j.getValues(),d=0,e=g.length;e>d;d++)f=g[d],f.subscribe(),c.add(f);return c})},c});
|