abort-controller-x-rxjs
Version:
Abortable helpers for RxJS
17 lines • 728 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.firstValueFrom = void 0;
const operators_1 = require("rxjs/operators");
const lastValueFrom_1 = require("./lastValueFrom");
/**
* Like original `firstValueFrom` from RxJS, but accepts `AbortSignal`. When
* that signal is aborted, unsubscribes from the observable and throws
* `AbortError`.
*/
function firstValueFrom(signal, source, config) {
return typeof config === 'object'
? lastValueFrom_1.lastValueFrom(signal, source.pipe(operators_1.first()), config)
: lastValueFrom_1.lastValueFrom(signal, source.pipe(operators_1.first()));
}
exports.firstValueFrom = firstValueFrom;
//# sourceMappingURL=firstValueFrom.js.map
;