source: trip-planner-front/node_modules/rxjs/_esm5/internal/observable/timer.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/** PURE_IMPORTS_START _Observable,_scheduler_async,_util_isNumeric,_util_isScheduler PURE_IMPORTS_END */
2import { Observable } from '../Observable';
3import { async } from '../scheduler/async';
4import { isNumeric } from '../util/isNumeric';
5import { isScheduler } from '../util/isScheduler';
6export function timer(dueTime, periodOrScheduler, scheduler) {
7 if (dueTime === void 0) {
8 dueTime = 0;
9 }
10 var period = -1;
11 if (isNumeric(periodOrScheduler)) {
12 period = Number(periodOrScheduler) < 1 && 1 || Number(periodOrScheduler);
13 }
14 else if (isScheduler(periodOrScheduler)) {
15 scheduler = periodOrScheduler;
16 }
17 if (!isScheduler(scheduler)) {
18 scheduler = async;
19 }
20 return new Observable(function (subscriber) {
21 var due = isNumeric(dueTime)
22 ? dueTime
23 : (+dueTime - scheduler.now());
24 return scheduler.schedule(dispatch, due, {
25 index: 0, period: period, subscriber: subscriber
26 });
27 });
28}
29function dispatch(state) {
30 var index = state.index, period = state.period, subscriber = state.subscriber;
31 subscriber.next(index);
32 if (subscriber.closed) {
33 return;
34 }
35 else if (period === -1) {
36 return subscriber.complete();
37 }
38 state.index = index + 1;
39 this.schedule(state, period);
40}
41//# sourceMappingURL=timer.js.map
Note: See TracBrowser for help on using the repository browser.