timers

Stable

Set one-off and periodic timers.

Globals

Constructors

Functions

setTimeout(callback, ms)

Schedules callback to be called in ms milliseconds. Any additional arguments are passed straight through to the callback.

Parameters

callback : function
Function to be called.

ms : integer
Interval in milliseconds after which the function will be called.

Returns

integer : An ID that can later be used to undo this scheduling, if callback hasn't yet been called.

clearTimeout(ID)

Given an ID returned from setTimeout(), prevents the callback with the ID from being called (if it hasn't yet been called).

Parameters

ID : integer
An ID returned from setTimeout().

setInterval(callback, ms)

Schedules callback to be called repeatedly every ms milliseconds. Any additional arguments are passed straight through to the callback.

Parameters

callback : function
Function to be called.

ms : integer
Interval in milliseconds at which the function will be called.

Returns

integer : An ID that can later be used to unschedule the callback.

clearInterval(ID)

Given an ID returned from setInterval(), prevents the callback with the ID from being called again.

Parameters

ID : integer
An ID returned from setInterval().

Document Tags and Contributors

Contributors to this page: wbamberg
Last updated by: wbamberg,