UNPKG

timerjobs

Version:

TimerJobs is a simple way to create recurring tasks that can react to events.

42 lines (41 loc) 1.14 kB
/// <reference types="node" /> import { EmitLevels } from './emit-level'; import { TimerJobs } from './index'; export interface IOptions extends Required<ITimerJobsOptions> { } export interface ITimerJobsOptions { autoStart?: boolean; blocking?: boolean; countdown?: number; delimiter?: string; emitLevel?: EmitLevels; emitter?: any; ignoreErrors?: boolean; immediate?: boolean; interval?: number; infinite?: boolean; namespace?: string; reference?: string; stopOn?: string; stopCallback?: Function; startOn?: string; startCallback?: Function; restartOn?: string; restartCallback?: Function; context?: any; } export interface ITimerJobs { restart(interval?: number): void; start(): void; stop(): void; isStarted: boolean; isStopped: boolean; waitTime: number; executions: number; errors: Error[]; busy: boolean; timer: NodeJS.Timeout; } export declare type Done = (error?: Error, ...args: any[]) => void; export declare type TimerCallback = (done: Done) => void; export declare type EventCallback = (timer: TimerJobs) => void;