timers-obj
Version:
Timers as objects
48 lines (47 loc) • 1.28 kB
TypeScript
export type TimerCallback = (...args: any[]) => void;
type ms = number;
export declare class Immediate {
protected timer?: NodeJS.Immediate;
constructor(callback: TimerCallback, ...args: any[]);
close(): this;
hasRef(): boolean;
ref(): this;
unref(): this;
[Symbol.dispose](): void;
}
export declare class Interval {
protected timer?: NodeJS.Timeout;
/**
* @param delay - ms
*/
constructor(delay: ms, callback: TimerCallback, ...args: any[]);
close(): this;
hasRef(): boolean;
ref(): this;
unref(): this;
refresh(): this;
[Symbol.dispose](): void;
}
export declare class Timeout {
protected timer?: NodeJS.Timeout;
/**
* @param delay - ms
*/
constructor(delay: ms, callback: TimerCallback, ...args: any[]);
close(): this;
hasRef(): boolean;
ref(): this;
unref(): this;
refresh(): this;
[Symbol.dispose](): void;
}
export declare function immediate(callback: TimerCallback, ...args: any[]): Immediate;
/**
* @param delay - ms
*/
export declare function interval(delay: ms, callback: TimerCallback, ...args: any[]): Interval;
/**
* @param delay - ms
*/
export declare function timeout(delay: ms, callback: TimerCallback, ...args: any[]): Timeout;
export {};