2022-06-08 10:36:39 +00:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
exports.delayWhen = void 0;
|
|
|
|
var concat_1 = require("../observable/concat");
|
|
|
|
var take_1 = require("./take");
|
|
|
|
var ignoreElements_1 = require("./ignoreElements");
|
|
|
|
var mapTo_1 = require("./mapTo");
|
|
|
|
var mergeMap_1 = require("./mergeMap");
|
2023-02-08 12:35:10 +00:00
|
|
|
var innerFrom_1 = require("../observable/innerFrom");
|
2022-06-08 10:36:39 +00:00
|
|
|
function delayWhen(delayDurationSelector, subscriptionDelay) {
|
|
|
|
if (subscriptionDelay) {
|
|
|
|
return function (source) {
|
|
|
|
return concat_1.concat(subscriptionDelay.pipe(take_1.take(1), ignoreElements_1.ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));
|
|
|
|
};
|
|
|
|
}
|
2023-02-08 12:35:10 +00:00
|
|
|
return mergeMap_1.mergeMap(function (value, index) { return innerFrom_1.innerFrom(delayDurationSelector(value, index)).pipe(take_1.take(1), mapTo_1.mapTo(value)); });
|
2022-06-08 10:36:39 +00:00
|
|
|
}
|
|
|
|
exports.delayWhen = delayWhen;
|
|
|
|
//# sourceMappingURL=delayWhen.js.map
|