Timers

DOM Style Timers

The Timers API provides functionality to allow developers to create DOM style timers.

Methods

(static) clearImmediate(id)

Cancels an Immediate timer created by setImmediate().

Source:
Parameters:
Name Type Description
id Number

The ID which identifies the timer.

(static) clearInterval(id)

The global clearInterval() method cancels an interval previously established by calling setInterval().

Source:
Parameters:
Name Type Description
id Number

The ID which identifies the timer.

(static) clearTimeout(id)

The global clearTimeout() method cancels a timeout previously established by calling setTimeout().

Source:
Parameters:
Name Type Description
id Number

The ID which identifies the timer.

(static) setImmediate(callback, …argsopt) → {Number}

Schedules the "immediate" execution of the callback after the I/O phase.

Source:
Parameters:
Name Type Attributes Description
callback function

A function to be executed after the I/O (poll) phase.

args any <optional>
<repeatable>

Additional arguments which are passed through to the function.

Returns:
Type:
Number

The ID which identifies the timer created.

(static) setInterval(callback, delay, …argsopt) → {Number}

Repeatedly calls a function or executes a code snippet, with a fixed time delay between each call.

Source:
Parameters:
Name Type Attributes Description
callback function

A function to be executed every delay milliseconds.

delay Number

The milliseconds the timer should delay in between executions.

args any <optional>
<repeatable>

Additional arguments which are passed through to the function.

Returns:
Type:
Number

The ID which identifies the timer created.

(static) setTimeout(callback, delay, …argsopt) → {Number}

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

Source:
Parameters:
Name Type Attributes Description
callback function

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 <optional>
<repeatable>

Additional arguments which are passed through to the function.

Returns:
Type:
Number

The ID which identifies the timer created.