Timer
API for creating and managing timers.
Functions
Timer.setInterval
Creates a timer which calls the function continuously with the given delay.
Timer.setInterval(duration: number, callback: function): number
Parameters
Name | Type | Default Value | Description |
---|---|---|---|
duration | number | Required | The time between function calls (in seconds). |
callback | function | Required | The function to call at each interval. |
Returns
Name | Type | Description |
---|---|---|
id | number | The ID of the timer. |
Timer.setTimeout
Creates a timer which calls the function once after the given delay.
Timer.setTimeout(duration: number, callback: function): number
Parameters
Name | Type | Default Value | Description |
---|---|---|---|
duration | number | Required | The delay before calling the function (in seconds). |
callback | function | Required | The function to call after the timeout. |
Returns
Name | Type | Description |
---|---|---|
id | number | The ID of the timer. |
Timer.clear
No description provided.
Timer.clear(id: number)
Parameters
Name | Type | Default Value | Description |
---|---|---|---|
id | number | Required | The ID of the timer to clear. |