Skip to main content
Version: Next

GlobalThis

The globalThis global object.

Methods

setTimeout()

setTimeout(
callback,
delay, ...
args?): number

Sets a timer which executes a function or specified piece of code once the timer expires. Also see setTimeout.

Parameters

ParameterTypeDescription

callback

(...args) => void

A function to be executed after the timer expires.

delay

number

The milliseconds that the timer should wait before the function is executed.

...args?

any[]

Additional arguments which are passed through to the function.

Returns

number

The ID (integer) which identifies the timer created.

Throws

Error if callback is not a function value.


clearTimeout()

clearTimeout(id): void

Cancels a timeout previously established by calling setTimeout.

Parameters

ParameterTypeDescription

id

number

The ID (integer) which identifies the timer.

Returns

void

Throws

Error if ID is not an integer value.