The function to be executed after the delay.
The amount of time (in milliseconds) to wait before executing the callback.
If the delay is 0
, the callback will be executed synchronously.
An object with a clear
method that can be used to cancel the timeout.
Clears the timeout if it was set.
// Executes the callback after 1 second (1000 milliseconds).
normalizedTimeoutCallback(() => {
console.log('Executed after 1 second');
}, 1000);
// Executes the callback immediately.
normalizedTimeoutCallback(() => {
console.log('Executed synchronously');
}, 0);
Launches a function after a specified delay. If the
delay
is zero, the callback is executed immediately (synchronously).