rxjs-rails 2.3.11 → 2.3.14
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 +54 -66
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.all.compat.js +326 -359
- data/vendor/assets/javascripts/rx.all.compat.min.js +3 -3
- data/vendor/assets/javascripts/rx.all.js +326 -359
- data/vendor/assets/javascripts/rx.all.min.js +3 -3
- data/vendor/assets/javascripts/rx.async.compat.js +21 -33
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +21 -33
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +242 -363
- data/vendor/assets/javascripts/rx.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.experimental.js +112 -0
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
- data/vendor/assets/javascripts/rx.js +242 -363
- data/vendor/assets/javascripts/rx.lite.compat.js +184 -295
- data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.lite.js +184 -295
- 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 +269 -252
- data/vendor/assets/javascripts/rx.testing.min.js +1 -1
- data/vendor/assets/javascripts/rx.time.js +1 -1
- data/vendor/assets/javascripts/rx.time.min.js +1 -1
- metadata +2 -2
@@ -307,7 +307,7 @@
|
|
307
307
|
}
|
308
308
|
}
|
309
309
|
var size = 0;
|
310
|
-
result = true;
|
310
|
+
var result = true;
|
311
311
|
|
312
312
|
// add `a` and `b` to the stack of traversed objects
|
313
313
|
stackA.push(a);
|
@@ -844,30 +844,30 @@ if (!Array.prototype.forEach) {
|
|
844
844
|
return RefCountDisposable;
|
845
845
|
})();
|
846
846
|
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
847
|
+
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
|
848
|
+
this.scheduler = scheduler;
|
849
|
+
this.state = state;
|
850
|
+
this.action = action;
|
851
|
+
this.dueTime = dueTime;
|
852
|
+
this.comparer = comparer || defaultSubComparer;
|
853
|
+
this.disposable = new SingleAssignmentDisposable();
|
854
|
+
}
|
855
855
|
|
856
|
-
|
857
|
-
|
858
|
-
|
856
|
+
ScheduledItem.prototype.invoke = function () {
|
857
|
+
this.disposable.setDisposable(this.invokeCore());
|
858
|
+
};
|
859
859
|
|
860
|
-
|
861
|
-
|
862
|
-
|
860
|
+
ScheduledItem.prototype.compareTo = function (other) {
|
861
|
+
return this.comparer(this.dueTime, other.dueTime);
|
862
|
+
};
|
863
863
|
|
864
|
-
|
865
|
-
|
866
|
-
|
864
|
+
ScheduledItem.prototype.isCancelled = function () {
|
865
|
+
return this.disposable.isDisposed;
|
866
|
+
};
|
867
867
|
|
868
|
-
|
869
|
-
|
870
|
-
|
868
|
+
ScheduledItem.prototype.invokeCore = function () {
|
869
|
+
return this.action(this.scheduler, this.state);
|
870
|
+
};
|
871
871
|
|
872
872
|
/** Provides a set of static properties to access commonly used schedulers. */
|
873
873
|
var Scheduler = Rx.Scheduler = (function () {
|
@@ -879,54 +879,6 @@ if (!Array.prototype.forEach) {
|
|
879
879
|
this._scheduleAbsolute = scheduleAbsolute;
|
880
880
|
}
|
881
881
|
|
882
|
-
function invokeRecImmediate(scheduler, pair) {
|
883
|
-
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
|
884
|
-
recursiveAction = function (state1) {
|
885
|
-
action(state1, function (state2) {
|
886
|
-
var isAdded = false, isDone = false,
|
887
|
-
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
|
888
|
-
if (isAdded) {
|
889
|
-
group.remove(d);
|
890
|
-
} else {
|
891
|
-
isDone = true;
|
892
|
-
}
|
893
|
-
recursiveAction(state3);
|
894
|
-
return disposableEmpty;
|
895
|
-
});
|
896
|
-
if (!isDone) {
|
897
|
-
group.add(d);
|
898
|
-
isAdded = true;
|
899
|
-
}
|
900
|
-
});
|
901
|
-
};
|
902
|
-
recursiveAction(state);
|
903
|
-
return group;
|
904
|
-
}
|
905
|
-
|
906
|
-
function invokeRecDate(scheduler, pair, method) {
|
907
|
-
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
|
908
|
-
recursiveAction = function (state1) {
|
909
|
-
action(state1, function (state2, dueTime1) {
|
910
|
-
var isAdded = false, isDone = false,
|
911
|
-
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
|
912
|
-
if (isAdded) {
|
913
|
-
group.remove(d);
|
914
|
-
} else {
|
915
|
-
isDone = true;
|
916
|
-
}
|
917
|
-
recursiveAction(state3);
|
918
|
-
return disposableEmpty;
|
919
|
-
});
|
920
|
-
if (!isDone) {
|
921
|
-
group.add(d);
|
922
|
-
isAdded = true;
|
923
|
-
}
|
924
|
-
});
|
925
|
-
};
|
926
|
-
recursiveAction(state);
|
927
|
-
return group;
|
928
|
-
}
|
929
|
-
|
930
882
|
function invokeAction(scheduler, action) {
|
931
883
|
action();
|
932
884
|
return disposableEmpty;
|
@@ -1246,34 +1198,34 @@ if (!Array.prototype.forEach) {
|
|
1246
1198
|
return currentScheduler;
|
1247
1199
|
}());
|
1248
1200
|
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1201
|
+
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
|
1202
|
+
function tick(command, recurse) {
|
1203
|
+
recurse(0, this._period);
|
1204
|
+
try {
|
1205
|
+
this._state = this._action(this._state);
|
1206
|
+
} catch (e) {
|
1207
|
+
this._cancel.dispose();
|
1208
|
+
throw e;
|
1209
|
+
}
|
1210
|
+
}
|
1259
1211
|
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
|
1212
|
+
function SchedulePeriodicRecursive(scheduler, state, period, action) {
|
1213
|
+
this._scheduler = scheduler;
|
1214
|
+
this._state = state;
|
1215
|
+
this._period = period;
|
1216
|
+
this._action = action;
|
1217
|
+
}
|
1266
1218
|
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1219
|
+
SchedulePeriodicRecursive.prototype.start = function () {
|
1220
|
+
var d = new SingleAssignmentDisposable();
|
1221
|
+
this._cancel = d;
|
1222
|
+
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
|
1271
1223
|
|
1272
|
-
|
1273
|
-
|
1224
|
+
return d;
|
1225
|
+
};
|
1274
1226
|
|
1275
|
-
|
1276
|
-
|
1227
|
+
return SchedulePeriodicRecursive;
|
1228
|
+
}());
|
1277
1229
|
|
1278
1230
|
var scheduleMethod, clearMethod = noop;
|
1279
1231
|
var localTimer = (function () {
|
@@ -1511,14 +1463,14 @@ if (!Array.prototype.forEach) {
|
|
1511
1463
|
function _acceptObservable(observer) { return observer.onError(this.exception); }
|
1512
1464
|
function toString () { return 'OnError(' + this.exception + ')'; }
|
1513
1465
|
|
1514
|
-
return function (
|
1466
|
+
return function (e) {
|
1515
1467
|
var notification = new Notification('E');
|
1516
|
-
notification.exception =
|
1468
|
+
notification.exception = e;
|
1517
1469
|
notification._accept = _accept;
|
1518
1470
|
notification._acceptObservable = _acceptObservable;
|
1519
1471
|
notification.toString = toString;
|
1520
1472
|
return notification;
|
1521
|
-
|
1473
|
+
};
|
1522
1474
|
}());
|
1523
1475
|
|
1524
1476
|
/**
|
@@ -1527,17 +1479,17 @@ if (!Array.prototype.forEach) {
|
|
1527
1479
|
*/
|
1528
1480
|
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
|
1529
1481
|
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1482
|
+
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
|
1483
|
+
function _acceptObservable(observer) { return observer.onCompleted(); }
|
1484
|
+
function toString () { return 'OnCompleted()'; }
|
1533
1485
|
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1486
|
+
return function () {
|
1487
|
+
var notification = new Notification('C');
|
1488
|
+
notification._accept = _accept;
|
1489
|
+
notification._acceptObservable = _acceptObservable;
|
1490
|
+
notification.toString = toString;
|
1491
|
+
return notification;
|
1492
|
+
};
|
1541
1493
|
}());
|
1542
1494
|
|
1543
1495
|
var Enumerator = Rx.internals.Enumerator = function (next) {
|
@@ -2087,7 +2039,7 @@ if (!Array.prototype.forEach) {
|
|
2087
2039
|
* @param {Any} [thisArg] The context to use calling the mapFn if provided.
|
2088
2040
|
* @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
|
2089
2041
|
*/
|
2090
|
-
Observable.from = function (iterable, mapFn, thisArg, scheduler) {
|
2042
|
+
var observableFrom = Observable.from = function (iterable, mapFn, thisArg, scheduler) {
|
2091
2043
|
if (iterable == null) {
|
2092
2044
|
throw new Error('iterable cannot be null.')
|
2093
2045
|
}
|
@@ -2105,7 +2057,13 @@ if (!Array.prototype.forEach) {
|
|
2105
2057
|
if (i < len || objIsIterable) {
|
2106
2058
|
var result;
|
2107
2059
|
if (objIsIterable) {
|
2108
|
-
var next
|
2060
|
+
var next;
|
2061
|
+
try {
|
2062
|
+
next = it.next();
|
2063
|
+
} catch (e) {
|
2064
|
+
observer.onError(e);
|
2065
|
+
return;
|
2066
|
+
}
|
2109
2067
|
if (next.done) {
|
2110
2068
|
observer.onCompleted();
|
2111
2069
|
return;
|
@@ -2113,7 +2071,7 @@ if (!Array.prototype.forEach) {
|
|
2113
2071
|
|
2114
2072
|
result = next.value;
|
2115
2073
|
} else {
|
2116
|
-
result = list[i];
|
2074
|
+
result = !!list.charAt ? list.charAt(i) : list[i];
|
2117
2075
|
}
|
2118
2076
|
|
2119
2077
|
if (mapFn && isCallable(mapFn)) {
|
@@ -3111,47 +3069,50 @@ if (!Array.prototype.forEach) {
|
|
3111
3069
|
});
|
3112
3070
|
};
|
3113
3071
|
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
|
3118
|
-
|
3119
|
-
|
3072
|
+
function concatMap(source, selector, thisArg) {
|
3073
|
+
return source.map(function (x, i) {
|
3074
|
+
var result = selector.call(thisArg, x, i, source);
|
3075
|
+
isPromise(result) && (result = observableFromPromise(result));
|
3076
|
+
(Array.isArray(result) || isIterable(result)) && (result = observableFrom(result));
|
3077
|
+
return result;
|
3078
|
+
}).concatAll();
|
3079
|
+
}
|
3120
3080
|
|
3121
|
-
|
3122
|
-
|
3123
|
-
|
3124
|
-
|
3125
|
-
|
3126
|
-
|
3127
|
-
|
3128
|
-
|
3129
|
-
|
3130
|
-
|
3131
|
-
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3138
|
-
|
3139
|
-
|
3140
|
-
|
3141
|
-
|
3142
|
-
|
3143
|
-
|
3144
|
-
|
3145
|
-
|
3146
|
-
|
3147
|
-
|
3148
|
-
|
3149
|
-
|
3150
|
-
}
|
3151
|
-
|
3152
|
-
|
3153
|
-
|
3154
|
-
|
3081
|
+
/**
|
3082
|
+
* One of the Following:
|
3083
|
+
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
|
3084
|
+
*
|
3085
|
+
* @example
|
3086
|
+
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
|
3087
|
+
* Or:
|
3088
|
+
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
|
3089
|
+
*
|
3090
|
+
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
|
3091
|
+
* Or:
|
3092
|
+
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
|
3093
|
+
*
|
3094
|
+
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
|
3095
|
+
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the
|
3096
|
+
* source sequence onto which could be either an observable or Promise.
|
3097
|
+
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
|
3098
|
+
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
|
3099
|
+
*/
|
3100
|
+
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
|
3101
|
+
if (typeof selector === 'function' && typeof resultSelector === 'function') {
|
3102
|
+
return this.concatMap(function (x, i) {
|
3103
|
+
var selectorResult = selector(x, i);
|
3104
|
+
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
|
3105
|
+
(Array.isArray(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
|
3106
|
+
|
3107
|
+
return selectorResult.map(function (y, i2) {
|
3108
|
+
return resultSelector(x, y, i, i2);
|
3109
|
+
});
|
3110
|
+
});
|
3111
|
+
}
|
3112
|
+
return typeof selector === 'function' ?
|
3113
|
+
concatMap(this, selector, thisArg) :
|
3114
|
+
concatMap(this, function () { return selector; });
|
3115
|
+
};
|
3155
3116
|
|
3156
3117
|
/**
|
3157
3118
|
* Projects each element of an observable sequence into a new form by incorporating the element's index.
|
@@ -3185,48 +3146,50 @@ if (!Array.prototype.forEach) {
|
|
3185
3146
|
return this.map(function (x) { return x[prop]; });
|
3186
3147
|
};
|
3187
3148
|
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
|
3193
|
-
|
3149
|
+
function flatMap(source, selector, thisArg) {
|
3150
|
+
return source.map(function (x, i) {
|
3151
|
+
var result = selector.call(thisArg, x, i, source);
|
3152
|
+
isPromise(result) && (result = observableFromPromise(result));
|
3153
|
+
(Array.isArray(result) || isIterable(result)) && (result = observableFrom(result));
|
3154
|
+
return result;
|
3155
|
+
}).mergeObservable();
|
3156
|
+
}
|
3194
3157
|
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
|
3213
|
-
|
3214
|
-
|
3215
|
-
|
3216
|
-
|
3217
|
-
|
3218
|
-
|
3219
|
-
|
3220
|
-
|
3221
|
-
|
3222
|
-
|
3223
|
-
|
3224
|
-
|
3225
|
-
|
3226
|
-
|
3227
|
-
|
3228
|
-
|
3229
|
-
|
3158
|
+
/**
|
3159
|
+
* One of the Following:
|
3160
|
+
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
|
3161
|
+
*
|
3162
|
+
* @example
|
3163
|
+
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
|
3164
|
+
* Or:
|
3165
|
+
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
|
3166
|
+
*
|
3167
|
+
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
|
3168
|
+
* Or:
|
3169
|
+
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
|
3170
|
+
*
|
3171
|
+
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
|
3172
|
+
* @param {Function} selector A transform function to apply to each element or an observable sequence to project each element from the source sequence onto which could be either an observable or Promise.
|
3173
|
+
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
|
3174
|
+
* @param {Any} [thisArg] Object to use as this when executing callback.
|
3175
|
+
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
|
3176
|
+
*/
|
3177
|
+
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
|
3178
|
+
if (typeof selector === 'function' && typeof resultSelector === 'function') {
|
3179
|
+
return this.flatMap(function (x, i) {
|
3180
|
+
var selectorResult = selector(x, i);
|
3181
|
+
isPromise(selectorResult) && (selectorResult = observableFromPromise(selectorResult));
|
3182
|
+
(Array.isArray(selectorResult) || isIterable(selectorResult)) && (selectorResult = observableFrom(selectorResult));
|
3183
|
+
|
3184
|
+
return selectorResult.map(function (y, i2) {
|
3185
|
+
return resultSelector(x, y, i, i2);
|
3186
|
+
});
|
3187
|
+
}, thisArg);
|
3188
|
+
}
|
3189
|
+
return typeof selector === 'function' ?
|
3190
|
+
flatMap(this, selector, thisArg) :
|
3191
|
+
flatMap(this, function () { return selector; });
|
3192
|
+
};
|
3230
3193
|
|
3231
3194
|
/**
|
3232
3195
|
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
|
@@ -4204,7 +4167,7 @@ if (!Array.prototype.forEach) {
|
|
4204
4167
|
* @returns {Observable} The source sequence switching to the other sequence in case of a timeout.
|
4205
4168
|
*/
|
4206
4169
|
observableProto.timeout = function (dueTime, other, scheduler) {
|
4207
|
-
other || (other = observableThrow(new Error('Timeout')));
|
4170
|
+
(other == null || typeof other === 'string') && (other = observableThrow(new Error(other || 'Timeout')));
|
4208
4171
|
isScheduler(scheduler) || (scheduler = timeoutScheduler);
|
4209
4172
|
|
4210
4173
|
var source = this, schedulerMethod = dueTime instanceof Date ?
|
@@ -4608,115 +4571,41 @@ if (!Array.prototype.forEach) {
|
|
4608
4571
|
return ControlledSubject;
|
4609
4572
|
}(Observable));
|
4610
4573
|
|
4611
|
-
|
4612
|
-
*
|
4613
|
-
*
|
4614
|
-
* @returns {Observable}
|
4574
|
+
/**
|
4575
|
+
* Executes a transducer to transform the observable sequence
|
4576
|
+
* @param {Transducer} transducer A transducer to execute
|
4577
|
+
* @returns {Observable} An Observable sequence containing the results from the transducer.
|
4615
4578
|
*/
|
4616
|
-
observableProto.
|
4617
|
-
var
|
4618
|
-
return new AnonymousObservable(function (observer) {
|
4619
|
-
var hasCurrent = false,
|
4620
|
-
isStopped = false,
|
4621
|
-
m = new SingleAssignmentDisposable(),
|
4622
|
-
g = new CompositeDisposable();
|
4623
|
-
|
4624
|
-
g.add(m);
|
4625
|
-
|
4626
|
-
m.setDisposable(sources.subscribe(
|
4627
|
-
function (innerSource) {
|
4628
|
-
if (!hasCurrent) {
|
4629
|
-
hasCurrent = true;
|
4630
|
-
|
4631
|
-
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
4632
|
-
|
4633
|
-
var innerSubscription = new SingleAssignmentDisposable();
|
4634
|
-
g.add(innerSubscription);
|
4579
|
+
observableProto.transduce = function(transducer) {
|
4580
|
+
var source = this;
|
4635
4581
|
|
4636
|
-
|
4637
|
-
|
4638
|
-
|
4639
|
-
|
4640
|
-
g.remove(innerSubscription);
|
4641
|
-
hasCurrent = false;
|
4642
|
-
if (isStopped && g.length === 1) {
|
4643
|
-
observer.onCompleted();
|
4644
|
-
}
|
4645
|
-
}));
|
4646
|
-
}
|
4582
|
+
function transformForObserver(observer) {
|
4583
|
+
return {
|
4584
|
+
init: function() {
|
4585
|
+
return observer;
|
4647
4586
|
},
|
4648
|
-
|
4649
|
-
|
4650
|
-
isStopped = true;
|
4651
|
-
if (!hasCurrent && g.length === 1) {
|
4652
|
-
observer.onCompleted();
|
4653
|
-
}
|
4654
|
-
}));
|
4655
|
-
|
4656
|
-
return g;
|
4657
|
-
});
|
4658
|
-
};
|
4659
|
-
|
4660
|
-
/*
|
4661
|
-
* Performs a exclusive map waiting for the first to finish before subscribing to another observable.
|
4662
|
-
* Observables that come in between subscriptions will be dropped on the floor.
|
4663
|
-
* @param {Function} selector Selector to invoke for every item in the current subscription.
|
4664
|
-
* @param {Any} [thisArg] An optional context to invoke with the selector parameter.
|
4665
|
-
* @returns {Observable} An exclusive observable with only the results that happen when subscribed.
|
4666
|
-
*/
|
4667
|
-
observableProto.exclusiveMap = function (selector, thisArg) {
|
4668
|
-
var sources = this;
|
4669
|
-
return new AnonymousObservable(function (observer) {
|
4670
|
-
var index = 0,
|
4671
|
-
hasCurrent = false,
|
4672
|
-
isStopped = true,
|
4673
|
-
m = new SingleAssignmentDisposable(),
|
4674
|
-
g = new CompositeDisposable();
|
4675
|
-
|
4676
|
-
g.add(m);
|
4677
|
-
|
4678
|
-
m.setDisposable(sources.subscribe(
|
4679
|
-
function (innerSource) {
|
4680
|
-
|
4681
|
-
if (!hasCurrent) {
|
4682
|
-
hasCurrent = true;
|
4683
|
-
|
4684
|
-
innerSubscription = new SingleAssignmentDisposable();
|
4685
|
-
g.add(innerSubscription);
|
4686
|
-
|
4687
|
-
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
|
4688
|
-
|
4689
|
-
innerSubscription.setDisposable(innerSource.subscribe(
|
4690
|
-
function (x) {
|
4691
|
-
var result;
|
4692
|
-
try {
|
4693
|
-
result = selector.call(thisArg, x, index++, innerSource);
|
4694
|
-
} catch (e) {
|
4695
|
-
observer.onError(e);
|
4696
|
-
return;
|
4697
|
-
}
|
4698
|
-
|
4699
|
-
observer.onNext(result);
|
4700
|
-
},
|
4701
|
-
observer.onError.bind(observer),
|
4702
|
-
function () {
|
4703
|
-
g.remove(innerSubscription);
|
4704
|
-
hasCurrent = false;
|
4705
|
-
|
4706
|
-
if (isStopped && g.length === 1) {
|
4707
|
-
observer.onCompleted();
|
4708
|
-
}
|
4709
|
-
}));
|
4710
|
-
}
|
4587
|
+
step: function(obs, input) {
|
4588
|
+
return obs.onNext(input);
|
4711
4589
|
},
|
4712
|
-
|
4713
|
-
|
4714
|
-
|
4715
|
-
|
4716
|
-
|
4590
|
+
result: function(obs) {
|
4591
|
+
return obs.onCompleted();
|
4592
|
+
}
|
4593
|
+
};
|
4594
|
+
}
|
4595
|
+
|
4596
|
+
return new AnonymousObservable(function(observer) {
|
4597
|
+
var xform = transducer(transformForObserver(observer));
|
4598
|
+
return source.subscribe(
|
4599
|
+
function(v) {
|
4600
|
+
try {
|
4601
|
+
xform.step(observer, v);
|
4602
|
+
} catch (e) {
|
4603
|
+
observer.onError(e);
|
4717
4604
|
}
|
4718
|
-
}
|
4719
|
-
|
4605
|
+
},
|
4606
|
+
observer.onError.bind(observer),
|
4607
|
+
function() { xform.result(observer); }
|
4608
|
+
);
|
4720
4609
|
});
|
4721
4610
|
};
|
4722
4611
|
|