GlobalThis
The globalThis global object.
Methods
clearInterval()
clearInterval(id): void;
Cancel a repeated timer previously established by calling setInterval.
Parameters
Parameter | Type | Description |
---|---|---|
|
| The ID (integer) which identifies the schedule. |
Returns
void
Throws
Throws TypeError if ID is not an integer.
clearTimeout()
clearTimeout(id): void;
Cancel a timeout previously established by calling setTimeout.
Parameters
Parameter | Type | Description |
---|---|---|
|
| The ID (integer) which identifies the timer. |
Returns
void
Throws
Throws TypeError if ID is not an integer.
queueMicrotask()
queueMicrotask(callback): void;
A microtask is a short function which is executed after the function or module which created it exits and only if the JavaScript execution stack is empty, but before returning control to the event loop being used to drive the script's execution environment.
Parameters
Parameter | Type | Description |
---|---|---|
| () => | A function to be executed. |
Returns
void
Throws
Throws TypeError if callback is not a function.
reportError()
reportError(error): void;
Dispatch an uncaught exception. Similar to synchronous version of setTimeout(() => {throw error;}, 0);
.
Parameters
Parameter | Type | Description |
---|---|---|
|
| Anything to be thrown. |
Returns
void
setInterval()
setInterval(
callback,
delay?, ...
args?): number;
Set a repeated timer that calls a function, with a fixed time delay between each call.
Parameters
Parameter | Type | Description |
---|---|---|
| (... | A function to be executed every |
|
| The milliseconds that the timer should delay in between execution of the function. This parameter can be omitted, by default is 1. |
... |
| Additional arguments which are passed through to the function. |
Returns
number
The ID (integer) which identifies the timer created.
Throws
Throws TypeError if callback is not a function, or delay is neither a number or undefined.
setTimeout()
setTimeout(
callback,
delay?, ...
args?): number;
Set a timer which executes a function or specified piece of code once the timer expires.
Parameters
Parameter | Type | Description |
---|---|---|
| (... | A function to be executed after the timer expires. |
|
| The milliseconds that the timer should wait before the function is executed. This parameter can be omitted, by default is 1. |
... |
| Additional arguments which are passed through to the function. |
Returns
number
The ID (integer) which identifies the timer created.
Throws
Throws TypeError if callback is not a function, or delay is neither a number or undefined.