mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
29 lines
1.0 KiB
JavaScript
29 lines
1.0 KiB
JavaScript
|
/** PURE_IMPORTS_START _Observable,_scheduler_async,_util_isNumeric PURE_IMPORTS_END */
|
||
|
import { Observable } from '../Observable';
|
||
|
import { async } from '../scheduler/async';
|
||
|
import { isNumeric } from '../util/isNumeric';
|
||
|
export function interval(period, scheduler) {
|
||
|
if (period === void 0) {
|
||
|
period = 0;
|
||
|
}
|
||
|
if (scheduler === void 0) {
|
||
|
scheduler = async;
|
||
|
}
|
||
|
if (!isNumeric(period) || period < 0) {
|
||
|
period = 0;
|
||
|
}
|
||
|
if (!scheduler || typeof scheduler.schedule !== 'function') {
|
||
|
scheduler = async;
|
||
|
}
|
||
|
return new Observable(function (subscriber) {
|
||
|
subscriber.add(scheduler.schedule(dispatch, period, { subscriber: subscriber, counter: 0, period: period }));
|
||
|
return subscriber;
|
||
|
});
|
||
|
}
|
||
|
function dispatch(state) {
|
||
|
var subscriber = state.subscriber, counter = state.counter, period = state.period;
|
||
|
subscriber.next(counter);
|
||
|
this.schedule({ subscriber: subscriber, counter: counter + 1, period: period }, period);
|
||
|
}
|
||
|
//# sourceMappingURL=interval.js.map
|