rxjs-rails 2.2.19 → 2.2.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/lib/rxjs/rails/version.rb +1 -1
- data/vendor/assets/javascripts/rx.aggregates.js +126 -121
- data/vendor/assets/javascripts/rx.aggregates.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.compat.js +2 -1
- data/vendor/assets/javascripts/rx.async.compat.min.js +1 -1
- data/vendor/assets/javascripts/rx.async.js +2 -1
- data/vendor/assets/javascripts/rx.async.min.js +1 -1
- data/vendor/assets/javascripts/rx.compat.js +470 -464
- data/vendor/assets/javascripts/rx.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.experimental.js +202 -191
- data/vendor/assets/javascripts/rx.experimental.min.js +1 -1
- data/vendor/assets/javascripts/rx.js +470 -464
- data/vendor/assets/javascripts/rx.lite.compat.js +352 -348
- data/vendor/assets/javascripts/rx.lite.compat.min.js +2 -2
- data/vendor/assets/javascripts/rx.lite.js +352 -348
- data/vendor/assets/javascripts/rx.lite.min.js +2 -2
- data/vendor/assets/javascripts/rx.min.js +2 -2
- data/vendor/assets/javascripts/rx.node.js +113 -115
- data/version.rb.m4 +6 -0
- metadata +3 -2
@@ -37,7 +37,7 @@
|
|
37
37
|
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
|
38
38
|
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
|
39
39
|
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
|
40
|
-
isPromise = Rx.helpers.isPromise = function (p) { return typeof p.then === 'function' && p.then !== Rx.Observable.prototype.then; },
|
40
|
+
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function' && p.then !== Rx.Observable.prototype.then; },
|
41
41
|
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
|
42
42
|
not = Rx.helpers.not = function (a) { return !a; };
|
43
43
|
|
@@ -1150,25 +1150,25 @@
|
|
1150
1150
|
|
1151
1151
|
var normalizeTime = Scheduler.normalize;
|
1152
1152
|
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1153
|
+
/**
|
1154
|
+
* Gets a scheduler that schedules work immediately on the current thread.
|
1155
|
+
*/
|
1156
|
+
var immediateScheduler = Scheduler.immediate = (function () {
|
1157
1157
|
|
1158
|
-
|
1158
|
+
function scheduleNow(state, action) { return action(this, state); }
|
1159
1159
|
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1160
|
+
function scheduleRelative(state, dueTime, action) {
|
1161
|
+
var dt = normalizeTime(dt);
|
1162
|
+
while (dt - this.now() > 0) { }
|
1163
|
+
return action(this, state);
|
1164
|
+
}
|
1165
1165
|
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1166
|
+
function scheduleAbsolute(state, dueTime, action) {
|
1167
|
+
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
|
1168
|
+
}
|
1169
1169
|
|
1170
|
-
|
1171
|
-
|
1170
|
+
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
1171
|
+
}());
|
1172
1172
|
|
1173
1173
|
/**
|
1174
1174
|
* Gets a scheduler that schedules work as soon as possible on the current thread.
|
@@ -1261,143 +1261,143 @@
|
|
1261
1261
|
return SchedulePeriodicRecursive;
|
1262
1262
|
}());
|
1263
1263
|
|
1264
|
-
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1268
|
-
var reNative = RegExp('^' +
|
1269
|
-
String(toString)
|
1270
|
-
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
1271
|
-
.replace(/toString| for [^\]]+/g, '.*?') + '$'
|
1272
|
-
);
|
1273
|
-
|
1274
|
-
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
|
1275
|
-
!reNative.test(setImmediate) && setImmediate,
|
1276
|
-
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
|
1277
|
-
!reNative.test(clearImmediate) && clearImmediate;
|
1278
|
-
|
1279
|
-
function postMessageSupported () {
|
1280
|
-
// Ensure not in a worker
|
1281
|
-
if (!root.postMessage || root.importScripts) { return false; }
|
1282
|
-
var isAsync = false,
|
1283
|
-
oldHandler = root.onmessage;
|
1284
|
-
// Test for async
|
1285
|
-
root.onmessage = function () { isAsync = true; };
|
1286
|
-
root.postMessage('','*');
|
1287
|
-
root.onmessage = oldHandler;
|
1288
|
-
|
1289
|
-
return isAsync;
|
1290
|
-
}
|
1264
|
+
|
1265
|
+
var scheduleMethod, clearMethod = noop;
|
1266
|
+
(function () {
|
1291
1267
|
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1268
|
+
var reNative = RegExp('^' +
|
1269
|
+
String(toString)
|
1270
|
+
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
1271
|
+
.replace(/toString| for [^\]]+/g, '.*?') + '$'
|
1272
|
+
);
|
1273
|
+
|
1274
|
+
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
|
1275
|
+
!reNative.test(setImmediate) && setImmediate,
|
1276
|
+
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
|
1277
|
+
!reNative.test(clearImmediate) && clearImmediate;
|
1278
|
+
|
1279
|
+
function postMessageSupported () {
|
1280
|
+
// Ensure not in a worker
|
1281
|
+
if (!root.postMessage || root.importScripts) { return false; }
|
1282
|
+
var isAsync = false,
|
1283
|
+
oldHandler = root.onmessage;
|
1284
|
+
// Test for async
|
1285
|
+
root.onmessage = function () { isAsync = true; };
|
1286
|
+
root.postMessage('','*');
|
1287
|
+
root.onmessage = oldHandler;
|
1288
|
+
|
1289
|
+
return isAsync;
|
1290
|
+
}
|
1312
1291
|
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1292
|
+
// Use in order, nextTick, setImmediate, postMessage, MessageChannel, script readystatechanged, setTimeout
|
1293
|
+
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
|
1294
|
+
scheduleMethod = process.nextTick;
|
1295
|
+
} else if (typeof setImmediate === 'function') {
|
1296
|
+
scheduleMethod = setImmediate;
|
1297
|
+
clearMethod = clearImmediate;
|
1298
|
+
} else if (postMessageSupported()) {
|
1299
|
+
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
|
1300
|
+
tasks = {},
|
1301
|
+
taskId = 0;
|
1302
|
+
|
1303
|
+
function onGlobalPostMessage(event) {
|
1304
|
+
// Only if we're a match to avoid any other global events
|
1305
|
+
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
|
1306
|
+
var handleId = event.data.substring(MSG_PREFIX.length),
|
1307
|
+
action = tasks[handleId];
|
1308
|
+
action();
|
1309
|
+
delete tasks[handleId];
|
1317
1310
|
}
|
1311
|
+
}
|
1318
1312
|
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
} else if (!!root.MessageChannel) {
|
1325
|
-
var channel = new root.MessageChannel(),
|
1326
|
-
channelTasks = {},
|
1327
|
-
channelTaskId = 0;
|
1328
|
-
|
1329
|
-
channel.port1.onmessage = function (event) {
|
1330
|
-
var id = event.data,
|
1331
|
-
action = channelTasks[id];
|
1332
|
-
action();
|
1333
|
-
delete channelTasks[id];
|
1334
|
-
};
|
1313
|
+
if (root.addEventListener) {
|
1314
|
+
root.addEventListener('message', onGlobalPostMessage, false);
|
1315
|
+
} else {
|
1316
|
+
root.attachEvent('onmessage', onGlobalPostMessage, false);
|
1317
|
+
}
|
1335
1318
|
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1319
|
+
scheduleMethod = function (action) {
|
1320
|
+
var currentId = taskId++;
|
1321
|
+
tasks[currentId] = action;
|
1322
|
+
root.postMessage(MSG_PREFIX + currentId, '*');
|
1323
|
+
};
|
1324
|
+
} else if (!!root.MessageChannel) {
|
1325
|
+
var channel = new root.MessageChannel(),
|
1326
|
+
channelTasks = {},
|
1327
|
+
channelTaskId = 0;
|
1328
|
+
|
1329
|
+
channel.port1.onmessage = function (event) {
|
1330
|
+
var id = event.data,
|
1331
|
+
action = channelTasks[id];
|
1332
|
+
action();
|
1333
|
+
delete channelTasks[id];
|
1334
|
+
};
|
1335
|
+
|
1336
|
+
scheduleMethod = function (action) {
|
1337
|
+
var id = channelTaskId++;
|
1338
|
+
channelTasks[id] = action;
|
1339
|
+
channel.port2.postMessage(id);
|
1340
|
+
};
|
1341
|
+
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
|
1342
|
+
|
1343
|
+
scheduleMethod = function (action) {
|
1344
|
+
var scriptElement = root.document.createElement('script');
|
1345
|
+
scriptElement.onreadystatechange = function () {
|
1346
|
+
action();
|
1347
|
+
scriptElement.onreadystatechange = null;
|
1348
|
+
scriptElement.parentNode.removeChild(scriptElement);
|
1349
|
+
scriptElement = null;
|
1350
|
+
};
|
1351
|
+
root.document.documentElement.appendChild(scriptElement);
|
1352
|
+
};
|
1359
1353
|
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1354
|
+
} else {
|
1355
|
+
scheduleMethod = function (action) { return setTimeout(action, 0); };
|
1356
|
+
clearMethod = clearTimeout;
|
1357
|
+
}
|
1358
|
+
}());
|
1364
1359
|
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1360
|
+
/**
|
1361
|
+
* Gets a scheduler that schedules work via a timed callback based upon platform.
|
1362
|
+
*/
|
1363
|
+
var timeoutScheduler = Scheduler.timeout = (function () {
|
1364
|
+
|
1365
|
+
function scheduleNow(state, action) {
|
1366
|
+
var scheduler = this,
|
1367
|
+
disposable = new SingleAssignmentDisposable();
|
1368
|
+
var id = scheduleMethod(function () {
|
1369
|
+
if (!disposable.isDisposed) {
|
1370
|
+
disposable.setDisposable(action(scheduler, state));
|
1371
|
+
}
|
1372
|
+
});
|
1373
|
+
return new CompositeDisposable(disposable, disposableCreate(function () {
|
1374
|
+
clearMethod(id);
|
1375
|
+
}));
|
1376
|
+
}
|
1377
1377
|
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
}
|
1384
|
-
var disposable = new SingleAssignmentDisposable();
|
1385
|
-
var id = setTimeout(function () {
|
1386
|
-
if (!disposable.isDisposed) {
|
1387
|
-
disposable.setDisposable(action(scheduler, state));
|
1388
|
-
}
|
1389
|
-
}, dt);
|
1390
|
-
return new CompositeDisposable(disposable, disposableCreate(function () {
|
1391
|
-
clearTimeout(id);
|
1392
|
-
}));
|
1378
|
+
function scheduleRelative(state, dueTime, action) {
|
1379
|
+
var scheduler = this,
|
1380
|
+
dt = Scheduler.normalize(dueTime);
|
1381
|
+
if (dt === 0) {
|
1382
|
+
return scheduler.scheduleWithState(state, action);
|
1393
1383
|
}
|
1384
|
+
var disposable = new SingleAssignmentDisposable();
|
1385
|
+
var id = setTimeout(function () {
|
1386
|
+
if (!disposable.isDisposed) {
|
1387
|
+
disposable.setDisposable(action(scheduler, state));
|
1388
|
+
}
|
1389
|
+
}, dt);
|
1390
|
+
return new CompositeDisposable(disposable, disposableCreate(function () {
|
1391
|
+
clearTimeout(id);
|
1392
|
+
}));
|
1393
|
+
}
|
1394
1394
|
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1395
|
+
function scheduleAbsolute(state, dueTime, action) {
|
1396
|
+
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
|
1397
|
+
}
|
1398
1398
|
|
1399
|
-
|
1400
|
-
|
1399
|
+
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
|
1400
|
+
})();
|
1401
1401
|
|
1402
1402
|
/**
|
1403
1403
|
* Represents a notification to an observer.
|
@@ -2021,28 +2021,26 @@
|
|
2021
2021
|
return new AnonymousObservable(subscribe);
|
2022
2022
|
};
|
2023
2023
|
|
2024
|
-
|
2025
|
-
|
2026
|
-
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2031
|
-
|
2032
|
-
|
2033
|
-
|
2034
|
-
|
2035
|
-
|
2036
|
-
|
2037
|
-
|
2038
|
-
|
2039
|
-
|
2040
|
-
|
2041
|
-
|
2042
|
-
|
2043
|
-
|
2044
|
-
});
|
2045
|
-
};
|
2024
|
+
/**
|
2025
|
+
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
|
2026
|
+
*
|
2027
|
+
* @example
|
2028
|
+
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
|
2029
|
+
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
|
2030
|
+
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
|
2031
|
+
*/
|
2032
|
+
var observableDefer = Observable.defer = function (observableFactory) {
|
2033
|
+
return new AnonymousObservable(function (observer) {
|
2034
|
+
var result;
|
2035
|
+
try {
|
2036
|
+
result = observableFactory();
|
2037
|
+
} catch (e) {
|
2038
|
+
return observableThrow(e).subscribe(observer);
|
2039
|
+
}
|
2040
|
+
isPromise(result) && (result = observableFromPromise(result));
|
2041
|
+
return result.subscribe(observer);
|
2042
|
+
});
|
2043
|
+
};
|
2046
2044
|
|
2047
2045
|
/**
|
2048
2046
|
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
|
@@ -2265,40 +2263,42 @@
|
|
2265
2263
|
});
|
2266
2264
|
};
|
2267
2265
|
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
|
2272
|
-
|
2273
|
-
|
2274
|
-
|
2275
|
-
|
2276
|
-
|
2277
|
-
|
2278
|
-
|
2279
|
-
}
|
2280
|
-
d = new SingleAssignmentDisposable();
|
2281
|
-
subscription.setDisposable(d);
|
2282
|
-
d.setDisposable(result.subscribe(observer));
|
2283
|
-
}, observer.onCompleted.bind(observer)));
|
2284
|
-
return subscription;
|
2285
|
-
});
|
2286
|
-
}
|
2287
|
-
|
2288
|
-
/**
|
2289
|
-
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
|
2290
|
-
* @example
|
2291
|
-
* 1 - xs.catchException(ys)
|
2292
|
-
* 2 - xs.catchException(function (ex) { return ys(ex); })
|
2293
|
-
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
|
2294
|
-
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
|
2295
|
-
*/
|
2296
|
-
observableProto['catch'] = observableProto.catchException = function (handlerOrSecond) {
|
2297
|
-
if (typeof handlerOrSecond === 'function') {
|
2298
|
-
return observableCatchHandler(this, handlerOrSecond);
|
2266
|
+
function observableCatchHandler(source, handler) {
|
2267
|
+
return new AnonymousObservable(function (observer) {
|
2268
|
+
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
|
2269
|
+
subscription.setDisposable(d1);
|
2270
|
+
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
|
2271
|
+
var d, result;
|
2272
|
+
try {
|
2273
|
+
result = handler(exception);
|
2274
|
+
} catch (ex) {
|
2275
|
+
observer.onError(ex);
|
2276
|
+
return;
|
2299
2277
|
}
|
2300
|
-
|
2301
|
-
|
2278
|
+
isPromise(result) && (result = observableFromPromise(result));
|
2279
|
+
|
2280
|
+
d = new SingleAssignmentDisposable();
|
2281
|
+
subscription.setDisposable(d);
|
2282
|
+
d.setDisposable(result.subscribe(observer));
|
2283
|
+
}, observer.onCompleted.bind(observer)));
|
2284
|
+
|
2285
|
+
return subscription;
|
2286
|
+
});
|
2287
|
+
}
|
2288
|
+
|
2289
|
+
/**
|
2290
|
+
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
|
2291
|
+
* @example
|
2292
|
+
* 1 - xs.catchException(ys)
|
2293
|
+
* 2 - xs.catchException(function (ex) { return ys(ex); })
|
2294
|
+
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
|
2295
|
+
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
|
2296
|
+
*/
|
2297
|
+
observableProto['catch'] = observableProto.catchException = function (handlerOrSecond) {
|
2298
|
+
return typeof handlerOrSecond === 'function' ?
|
2299
|
+
observableCatchHandler(this, handlerOrSecond) :
|
2300
|
+
observableCatch([this, handlerOrSecond]);
|
2301
|
+
};
|
2302
2302
|
|
2303
2303
|
/**
|
2304
2304
|
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
|
@@ -2313,87 +2313,89 @@
|
|
2313
2313
|
return enumerableFor(items).catchException();
|
2314
2314
|
};
|
2315
2315
|
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2332
|
-
|
2333
|
-
|
2316
|
+
/**
|
2317
|
+
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
|
2318
|
+
* This can be in the form of an argument list of observables or an array.
|
2319
|
+
*
|
2320
|
+
* @example
|
2321
|
+
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
|
2322
|
+
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
|
2323
|
+
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
2324
|
+
*/
|
2325
|
+
observableProto.combineLatest = function () {
|
2326
|
+
var args = slice.call(arguments);
|
2327
|
+
if (Array.isArray(args[0])) {
|
2328
|
+
args[0].unshift(this);
|
2329
|
+
} else {
|
2330
|
+
args.unshift(this);
|
2331
|
+
}
|
2332
|
+
return combineLatest.apply(this, args);
|
2333
|
+
};
|
2334
2334
|
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2335
|
+
/**
|
2336
|
+
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
|
2337
|
+
*
|
2338
|
+
* @example
|
2339
|
+
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
|
2340
|
+
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
|
2341
|
+
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
2342
|
+
*/
|
2343
|
+
var combineLatest = Observable.combineLatest = function () {
|
2344
|
+
var args = slice.call(arguments), resultSelector = args.pop();
|
2345
|
+
|
2346
|
+
if (Array.isArray(args[0])) {
|
2347
|
+
args = args[0];
|
2348
|
+
}
|
2349
2349
|
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2350
|
+
return new AnonymousObservable(function (observer) {
|
2351
|
+
var falseFactory = function () { return false; },
|
2352
|
+
n = args.length,
|
2353
|
+
hasValue = arrayInitialize(n, falseFactory),
|
2354
|
+
hasValueAll = false,
|
2355
|
+
isDone = arrayInitialize(n, falseFactory),
|
2356
|
+
values = new Array(n);
|
2357
2357
|
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2363
|
-
|
2364
|
-
|
2365
|
-
|
2366
|
-
|
2367
|
-
|
2368
|
-
|
2369
|
-
|
2370
|
-
|
2371
|
-
|
2372
|
-
|
2358
|
+
function next(i) {
|
2359
|
+
var res;
|
2360
|
+
hasValue[i] = true;
|
2361
|
+
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
|
2362
|
+
try {
|
2363
|
+
res = resultSelector.apply(null, values);
|
2364
|
+
} catch (ex) {
|
2365
|
+
observer.onError(ex);
|
2366
|
+
return;
|
2367
|
+
}
|
2368
|
+
observer.onNext(res);
|
2369
|
+
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
2370
|
+
observer.onCompleted();
|
2371
|
+
}
|
2372
|
+
}
|
2373
2373
|
|
2374
|
-
|
2375
|
-
|
2376
|
-
|
2377
|
-
|
2378
|
-
|
2379
|
-
|
2374
|
+
function done (i) {
|
2375
|
+
isDone[i] = true;
|
2376
|
+
if (isDone.every(identity)) {
|
2377
|
+
observer.onCompleted();
|
2378
|
+
}
|
2379
|
+
}
|
2380
2380
|
|
2381
|
-
|
2382
|
-
|
2383
|
-
|
2384
|
-
|
2385
|
-
|
2386
|
-
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
2390
|
-
|
2391
|
-
|
2392
|
-
|
2381
|
+
var subscriptions = new Array(n);
|
2382
|
+
for (var idx = 0; idx < n; idx++) {
|
2383
|
+
(function (i) {
|
2384
|
+
var source = args[i], sad = new SingleAssignmentDisposable();
|
2385
|
+
isPromise(source) && (source = observableFromPromise(source));
|
2386
|
+
sad.setDisposable(source.subscribe(function (x) {
|
2387
|
+
values[i] = x;
|
2388
|
+
next(i);
|
2389
|
+
}, observer.onError.bind(observer), function () {
|
2390
|
+
done(i);
|
2391
|
+
}));
|
2392
|
+
subscriptions[i] = sad;
|
2393
|
+
}(idx));
|
2394
|
+
}
|
2393
2395
|
|
2394
|
-
|
2395
|
-
|
2396
|
-
|
2396
|
+
return new CompositeDisposable(subscriptions);
|
2397
|
+
});
|
2398
|
+
};
|
2397
2399
|
|
2398
2400
|
/**
|
2399
2401
|
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
|
@@ -2646,86 +2648,88 @@
|
|
2646
2648
|
});
|
2647
2649
|
};
|
2648
2650
|
|
2649
|
-
|
2650
|
-
|
2651
|
-
|
2652
|
-
|
2653
|
-
|
2654
|
-
|
2655
|
-
|
2656
|
-
|
2657
|
-
|
2658
|
-
|
2659
|
-
|
2660
|
-
|
2661
|
-
|
2662
|
-
|
2663
|
-
|
2664
|
-
|
2665
|
-
|
2666
|
-
|
2667
|
-
|
2668
|
-
|
2651
|
+
function zipArray(second, resultSelector) {
|
2652
|
+
var first = this;
|
2653
|
+
return new AnonymousObservable(function (observer) {
|
2654
|
+
var index = 0, len = second.length;
|
2655
|
+
return first.subscribe(function (left) {
|
2656
|
+
if (index < len) {
|
2657
|
+
var right = second[index++], result;
|
2658
|
+
try {
|
2659
|
+
result = resultSelector(left, right);
|
2660
|
+
} catch (e) {
|
2661
|
+
observer.onError(e);
|
2662
|
+
return;
|
2663
|
+
}
|
2664
|
+
observer.onNext(result);
|
2665
|
+
} else {
|
2666
|
+
observer.onCompleted();
|
2667
|
+
}
|
2668
|
+
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
|
2669
|
+
});
|
2670
|
+
}
|
2669
2671
|
|
2670
|
-
|
2671
|
-
|
2672
|
-
|
2673
|
-
|
2674
|
-
|
2675
|
-
|
2676
|
-
|
2677
|
-
|
2678
|
-
|
2679
|
-
|
2680
|
-
|
2681
|
-
|
2672
|
+
/**
|
2673
|
+
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
|
2674
|
+
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
|
2675
|
+
*
|
2676
|
+
* @example
|
2677
|
+
* 1 - res = obs1.zip(obs2, fn);
|
2678
|
+
* 1 - res = x1.zip([1,2,3], fn);
|
2679
|
+
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
|
2680
|
+
*/
|
2681
|
+
observableProto.zip = function () {
|
2682
|
+
if (Array.isArray(arguments[0])) {
|
2683
|
+
return zipArray.apply(this, arguments);
|
2684
|
+
}
|
2685
|
+
var parent = this, sources = slice.call(arguments), resultSelector = sources.pop();
|
2686
|
+
sources.unshift(parent);
|
2687
|
+
return new AnonymousObservable(function (observer) {
|
2688
|
+
var n = sources.length,
|
2689
|
+
queues = arrayInitialize(n, function () { return []; }),
|
2690
|
+
isDone = arrayInitialize(n, function () { return false; });
|
2691
|
+
|
2692
|
+
function next(i) {
|
2693
|
+
var res, queuedValues;
|
2694
|
+
if (queues.every(function (x) { return x.length > 0; })) {
|
2695
|
+
try {
|
2696
|
+
queuedValues = queues.map(function (x) { return x.shift(); });
|
2697
|
+
res = resultSelector.apply(parent, queuedValues);
|
2698
|
+
} catch (ex) {
|
2699
|
+
observer.onError(ex);
|
2700
|
+
return;
|
2701
|
+
}
|
2702
|
+
observer.onNext(res);
|
2703
|
+
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
2704
|
+
observer.onCompleted();
|
2682
2705
|
}
|
2683
|
-
|
2684
|
-
sources.unshift(parent);
|
2685
|
-
return new AnonymousObservable(function (observer) {
|
2686
|
-
var n = sources.length,
|
2687
|
-
queues = arrayInitialize(n, function () { return []; }),
|
2688
|
-
isDone = arrayInitialize(n, function () { return false; });
|
2689
|
-
|
2690
|
-
var next = function (i) {
|
2691
|
-
var res, queuedValues;
|
2692
|
-
if (queues.every(function (x) { return x.length > 0; })) {
|
2693
|
-
try {
|
2694
|
-
queuedValues = queues.map(function (x) { return x.shift(); });
|
2695
|
-
res = resultSelector.apply(parent, queuedValues);
|
2696
|
-
} catch (ex) {
|
2697
|
-
observer.onError(ex);
|
2698
|
-
return;
|
2699
|
-
}
|
2700
|
-
observer.onNext(res);
|
2701
|
-
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
|
2702
|
-
observer.onCompleted();
|
2703
|
-
}
|
2704
|
-
};
|
2706
|
+
};
|
2705
2707
|
|
2706
|
-
|
2707
|
-
|
2708
|
-
|
2709
|
-
|
2710
|
-
|
2711
|
-
|
2708
|
+
function done(i) {
|
2709
|
+
isDone[i] = true;
|
2710
|
+
if (isDone.every(function (x) { return x; })) {
|
2711
|
+
observer.onCompleted();
|
2712
|
+
}
|
2713
|
+
}
|
2712
2714
|
|
2713
|
-
|
2714
|
-
|
2715
|
-
|
2716
|
-
|
2717
|
-
|
2718
|
-
|
2719
|
-
|
2720
|
-
|
2721
|
-
|
2722
|
-
|
2723
|
-
|
2724
|
-
|
2715
|
+
var subscriptions = new Array(n);
|
2716
|
+
for (var idx = 0; idx < n; idx++) {
|
2717
|
+
(function (i) {
|
2718
|
+
var source = sources[i], sad = new SingleAssignmentDisposable();
|
2719
|
+
isPromise(source) && (source = observableFromPromise(source));
|
2720
|
+
sad.setDisposable(source.subscribe(function (x) {
|
2721
|
+
queues[i].push(x);
|
2722
|
+
next(i);
|
2723
|
+
}, observer.onError.bind(observer), function () {
|
2724
|
+
done(i);
|
2725
|
+
}));
|
2726
|
+
subscriptions[i] = sad;
|
2727
|
+
})(idx);
|
2728
|
+
}
|
2725
2729
|
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
2730
|
+
return new CompositeDisposable(subscriptions);
|
2731
|
+
});
|
2732
|
+
};
|
2729
2733
|
/**
|
2730
2734
|
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
|
2731
2735
|
* @param arguments Observable sources.
|
@@ -3575,7 +3579,7 @@
|
|
3575
3579
|
selector);
|
3576
3580
|
}
|
3577
3581
|
if (jq) {
|
3578
|
-
var $elem = jq(
|
3582
|
+
var $elem = jq(element);
|
3579
3583
|
return fromEventPattern(
|
3580
3584
|
function (h) { $elem.on(eventName, h); },
|
3581
3585
|
function (h) { $elem.off(eventName, h); },
|