Skip to main content

Class: TimerManager

@sapphire/time-utilities.TimerManager

Manages timers so that this application can be cleanly exited

Hierarchy

  • any

    โ†ณ TimerManager

Constructors

constructor

โ€ข new TimerManager()

Inherited from

null.constructor

Properties

storedIntervals

โ–ช Static Private storedIntervals: Set<Timeout>

A set of intervals to clear on destroy

Defined in

projects/utilities/packages/time-utilities/src/lib/TimerManager.ts:13


storedTimeouts

โ–ช Static Private storedTimeouts: Set<Timeout>

A set of timeouts to clear on destroy

Defined in

projects/utilities/packages/time-utilities/src/lib/TimerManager.ts:8

Methods

clearInterval

โ–ธ Static clearInterval(interval): void

Clears an internal created through this class

Parameters

NameTypeDescription
intervalTimeoutThe interval to clear

Returns

void

Defined in

projects/utilities/packages/time-utilities/src/lib/TimerManager.ts:55


clearTimeout

โ–ธ Static clearTimeout(timeout): void

Clears a timeout created through this class

Parameters

NameTypeDescription
timeoutTimeoutThe timeout to clear

Returns

void

Defined in

projects/utilities/packages/time-utilities/src/lib/TimerManager.ts:34


destroy

โ–ธ Static destroy(): void

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

Returns

void

Defined in

projects/utilities/packages/time-utilities/src/lib/TimerManager.ts:63


setInterval

โ–ธ Static setInterval<A>(fn, delay, ...args): Timeout

Creates an interval gets cleared when destroyed

Type parameters

NameType
Aunknown

Parameters

NameTypeDescription
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

projects/utilities/packages/time-utilities/src/lib/TimerManager.ts:45


setTimeout

โ–ธ Static setTimeout<A>(fn, delay, ...args): Timeout

Creates a timeout gets cleared when destroyed

Type parameters

NameType
Aunknown

Parameters

NameTypeDescription
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

projects/utilities/packages/time-utilities/src/lib/TimerManager.ts:21