timeoutWith.js 870 B

12345678910111213141516171819202122232425262728293031
  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. var first;
  6. var each;
  7. var _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 = function () { return 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: first,
  26. each: each,
  27. scheduler: scheduler,
  28. with: _with,
  29. });
  30. }
  31. //# sourceMappingURL=timeoutWith.js.map