source: trip-planner-front/node_modules/rxjs/_esm2015/internal/observable/interval.js@ 6c1585f

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

initial commit

  • Property mode set to 100644
File size: 758 bytes
Line 
1import { Observable } from '../Observable';
2import { async } from '../scheduler/async';
3import { isNumeric } from '../util/isNumeric';
4export function interval(period = 0, scheduler = async) {
5 if (!isNumeric(period) || period < 0) {
6 period = 0;
7 }
8 if (!scheduler || typeof scheduler.schedule !== 'function') {
9 scheduler = async;
10 }
11 return new Observable(subscriber => {
12 subscriber.add(scheduler.schedule(dispatch, period, { subscriber, counter: 0, period }));
13 return subscriber;
14 });
15}
16function dispatch(state) {
17 const { subscriber, counter, period } = state;
18 subscriber.next(counter);
19 this.schedule({ subscriber, counter: counter + 1, period }, period);
20}
21//# sourceMappingURL=interval.js.map
Note: See TracBrowser for help on using the repository browser.