hugoWebsite/node_modules/rxjs/dist/esm5/internal/operators/delayWhen.js

14 lines
638 B
JavaScript
Raw Normal View History

2022-10-29 00:20:35 +02:00
import { concat } from '../observable/concat';
import { take } from './take';
import { ignoreElements } from './ignoreElements';
import { mapTo } from './mapTo';
import { mergeMap } from './mergeMap';
export function delayWhen(delayDurationSelector, subscriptionDelay) {
if (subscriptionDelay) {
return function (source) {
return concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
};
}
return mergeMap(function (value, index) { return delayDurationSelector(value, index).pipe(take(1), mapTo(value)); });
}
//# sourceMappingURL=delayWhen.js.map