| 1 |
"use strict"; |
| 2 |
Object.defineProperty(exports, "__esModule", { value: true }); |
| 3 |
exports.timeoutWith = void 0; |
| 4 |
var async_1 = require("../scheduler/async"); |
| 5 |
var isDate_1 = require("../util/isDate"); |
| 6 |
var timeout_1 = require("./timeout"); |
| 7 |
function timeoutWith(due, withObservable, scheduler) { |
| 8 |
var first; |
| 9 |
var each; |
| 10 |
var _with; |
| 11 |
scheduler = scheduler !== null && scheduler !== void 0 ? scheduler : async_1.async; |
| 12 |
if (isDate_1.isValidDate(due)) { |
| 13 |
first = due; |
| 14 |
} |
| 15 |
else if (typeof due === 'number') { |
| 16 |
each = due; |
| 17 |
} |
| 18 |
if (withObservable) { |
| 19 |
_with = function () { return withObservable; }; |
| 20 |
} |
| 21 |
else { |
| 22 |
throw new TypeError('No observable provided to switch to'); |
| 23 |
} |
| 24 |
if (first == null && each == null) { |
| 25 |
throw new TypeError('No timeout provided.'); |
| 26 |
} |
| 27 |
return timeout_1.timeout({ |
| 28 |
first: first, |
| 29 |
each: each, |
| 30 |
scheduler: scheduler, |
| 31 |
with: _with, |
| 32 |
}); |
| 33 |
} |
| 34 |
exports.timeoutWith = timeoutWith; |
| 35 |
//# sourceMappingURL=timeoutWith.js.map |