Tumortisch-Dist/resources/app/node_modules/rxjs/operator/withLatestFrom.js
2021-06-15 16:00:08 +02:00

50 lines
2.3 KiB
JavaScript

"use strict";
var withLatestFrom_1 = require('../operators/withLatestFrom');
/* tslint:enable:max-line-length */
/**
* Combines the source Observable with other Observables to create an Observable
* whose values are calculated from the latest values of each, only when the
* source emits.
*
* <span class="informal">Whenever the source Observable emits a value, it
* computes a formula using that value plus the latest values from other input
* Observables, then emits the output of that formula.</span>
*
* <img src="./img/withLatestFrom.png" width="100%">
*
* `withLatestFrom` combines each value from the source Observable (the
* instance) with the latest values from the other input Observables only when
* the source emits a value, optionally using a `project` function to determine
* the value to be emitted on the output Observable. All input Observables must
* emit at least one value before the output Observable will emit a value.
*
* @example <caption>On every click event, emit an array with the latest timer event plus the click event</caption>
* var clicks = Rx.Observable.fromEvent(document, 'click');
* var timer = Rx.Observable.interval(1000);
* var result = clicks.withLatestFrom(timer);
* result.subscribe(x => console.log(x));
*
* @see {@link combineLatest}
*
* @param {ObservableInput} other An input Observable to combine with the source
* Observable. More than one input Observables may be given as argument.
* @param {Function} [project] Projection function for combining values
* together. Receives all values in order of the Observables passed, where the
* first parameter is a value from the source Observable. (e.g.
* `a.withLatestFrom(b, c, (a1, b1, c1) => a1 + b1 + c1)`). If this is not
* passed, arrays will be emitted on the output Observable.
* @return {Observable} An Observable of projected values from the most recent
* values from each input Observable, or an array of the most recent values from
* each input Observable.
* @method withLatestFrom
* @owner Observable
*/
function withLatestFrom() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
return withLatestFrom_1.withLatestFrom.apply(void 0, args)(this);
}
exports.withLatestFrom = withLatestFrom;
//# sourceMappingURL=withLatestFrom.js.map