delayWhen.js 702 B

123456789101112131415
  1. import { concat } from '../observable/concat';
  2. import { take } from './take';
  3. import { ignoreElements } from './ignoreElements';
  4. import { mapTo } from './mapTo';
  5. import { mergeMap } from './mergeMap';
  6. import { innerFrom } from '../observable/innerFrom';
  7. export function delayWhen(delayDurationSelector, subscriptionDelay) {
  8. if (subscriptionDelay) {
  9. return function (source) {
  10. return concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
  11. };
  12. }
  13. return mergeMap(function (value, index) { return innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)); });
  14. }
  15. //# sourceMappingURL=delayWhen.js.map