UNPKG

@most/scheduler

Version:

Reactive programming with lean, functions-only, curried, tree-shakeable API

22 lines (21 loc) 902 B
/** @license MIT License (c) copyright 2010-2017 original author or authors */ import ScheduledTaskImpl from './ScheduledTask'; import { Scheduler, Time, Timer, Timeline, Task, ScheduledTask } from '@most/types'; export default class SchedulerImpl implements Scheduler { private readonly timer; private readonly timeline; private _timer; private _nextArrival; private _runReadyTasksBound; constructor(timer: Timer, timeline: Timeline); currentTime(): Time; scheduleTask(localOffset: Time, delay: Time, period: Time, task: Task): ScheduledTaskImpl; relative(offset: Time): Scheduler; cancel(task: ScheduledTaskImpl): void; cancelAll(f: (task: ScheduledTask) => boolean): void; _reschedule(): void; _unschedule(): void; _scheduleNextRun(): void; _scheduleNextArrival(nextArrival: Time): void; _runReadyTasks(): void; }