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

15 lines
702 B
JavaScript
Raw Normal View History

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