delayWhen.js 908 B

12345678910111213141516171819
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.delayWhen = void 0;
  4. var concat_1 = require("../observable/concat");
  5. var take_1 = require("./take");
  6. var ignoreElements_1 = require("./ignoreElements");
  7. var mapTo_1 = require("./mapTo");
  8. var mergeMap_1 = require("./mergeMap");
  9. var innerFrom_1 = require("../observable/innerFrom");
  10. function delayWhen(delayDurationSelector, subscriptionDelay) {
  11. if (subscriptionDelay) {
  12. return function (source) {
  13. return concat_1.concat(subscriptionDelay.pipe(take_1.take(1), ignoreElements_1.ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
  14. };
  15. }
  16. return mergeMap_1.mergeMap(function (value, index) { return innerFrom_1.innerFrom(delayDurationSelector(value, index)).pipe(take_1.take(1), mapTo_1.mapTo(value)); });
  17. }
  18. exports.delayWhen = delayWhen;
  19. //# sourceMappingURL=delayWhen.js.map