Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / rxjs / _esm2015 / internal / observable / interval.js
1 import { Observable } from '../Observable';
2 import { async } from '../scheduler/async';
3 import { isNumeric } from '../util/isNumeric';
4 export 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 }
16 function 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