Skip to main content

Class: TimerManager

Manages timers so that this application can be cleanly exited

Extends​

  • any

Constructors​

new TimerManager()​

new TimerManager(): TimerManager

Returns​

TimerManager

Inherited from​

null.constructor

Properties​

storedIntervals​

private static storedIntervals: any

A set of intervals to clear on destroy

Defined in​

timer-manager/dist/esm/index.d.mts:12


storedTimeouts​

private static storedTimeouts: any

A set of timeouts to clear on destroy

Defined in​

timer-manager/dist/esm/index.d.mts:8

Methods​

clearInterval()​

static clearInterval(interval: Timeout): void

Clears an internal created through this class

Parameters​

ParameterTypeDescription
intervalTimeoutThe interval to clear

Returns​

void

Defined in​

timer-manager/dist/esm/index.d.mts:36


clearTimeout()​

static clearTimeout(timeout: Timeout): void

Clears a timeout created through this class

Parameters​

ParameterTypeDescription
timeoutTimeoutThe timeout to clear

Returns​

void

Defined in​

timer-manager/dist/esm/index.d.mts:24


destroy()​

static destroy(): void

Clears running timeouts and intervals created through this class so NodeJS can gracefully exit

Returns​

void

Defined in​

timer-manager/dist/esm/index.d.mts:40


setInterval()​

static setInterval<A>(fn: (...args: A[]) => void, delay: number, ...args: A[]): Timeout

Creates an interval gets cleared when destroyed

Type Parameters​

Type ParameterDefault type
Aunknown

Parameters​

ParameterTypeDescription
fn(...args: A[]) => voidcallback function
delaynumberamount of time before running the callback
...argsA[]additional arguments to pass back to the callback

Returns​

Timeout

Defined in​

timer-manager/dist/esm/index.d.mts:31


setTimeout()​

static setTimeout<A>(fn: (...args: A[]) => void, delay: number, ...args: A[]): Timeout

Creates a timeout gets cleared when destroyed

Type Parameters​

Type ParameterDefault type
Aunknown

Parameters​

ParameterTypeDescription
fn(...args: A[]) => voidcallback function
delaynumberamount of time before running the callback
...argsA[]additional arguments to pass back to the callback

Returns​

Timeout

Defined in​

timer-manager/dist/esm/index.d.mts:19