| 1 |
import { async } from '../scheduler/async'; |
| 2 |
import { isValidDate } from '../util/isDate'; |
| 3 |
import { timeout } from './timeout'; |
| 4 |
export function timeoutWith(due, withObservable, scheduler) { |
| 5 |
let first; |
| 6 |
let each; |
| 7 |
let _with; |
| 8 |
scheduler = scheduler !== null && scheduler !== void 0 ? scheduler : async; |
| 9 |
if (isValidDate(due)) { |
| 10 |
first = due; |
| 11 |
} |
| 12 |
else if (typeof due === 'number') { |
| 13 |
each = due; |
| 14 |
} |
| 15 |
if (withObservable) { |
| 16 |
_with = () => withObservable; |
| 17 |
} |
| 18 |
else { |
| 19 |
throw new TypeError('No observable provided to switch to'); |
| 20 |
} |
| 21 |
if (first == null && each == null) { |
| 22 |
throw new TypeError('No timeout provided.'); |
| 23 |
} |
| 24 |
return timeout({ |
| 25 |
first, |
| 26 |
each, |
| 27 |
scheduler, |
| 28 |
with: _with, |
| 29 |
}); |
| 30 |
} |
| 31 |
//# sourceMappingURL=timeoutWith.js.map |