UNPKG

@toreda/time

Version:

Simple, small footprint library for common time operations and converting between units of time.

25 lines (24 loc) 933 B
import type { TimerCallback } from '../callback'; import type { TimerCallbackSync } from './sync'; export type TimerCallbackKind = 'once' | 'always'; export type TimerCallbackFn = TimerCallback | TimerCallbackSync; /** * @category Timers */ export declare class TimerCallbackGroup { readonly id: string; private readonly _once; private readonly _always; constructor(id?: string | null); reset(): void; onceCt(): number; alwaysCt(): number; on(kind: TimerCallbackKind, fn: TimerCallbackFn): boolean; once(fn: TimerCallbackFn): boolean; always(fn: TimerCallbackFn): boolean; remove(kind: TimerCallbackKind, fn: TimerCallbackFn): boolean; invoke(fn: TimerCallbackFn, duration?: number | null): Promise<void>; executeAll(duration?: number | null): Promise<void>; executeOnce(duration?: number | null): Promise<void>; executeAlways(duration?: number | null): Promise<void>; }