目录

Timer

clearInterval

clearInterval(number intervalID)

Cancels the timer set by calling setInterval.

Since: 1.0.0

Parameters

Name

Type

Mandatory

Description

intervalID

number

Yes

ID of the timer to cancel.

Example

clearInterval(111);

setInterval

setInterval(function callback, number delay, any rest)

Sets a timer.

Since: 1.0.0

Parameters

Name

Type

Mandatory

Description

callback

function

Yes

Callback.

delay

number

Yes

Interval at which the callback is executed, in ms.

It is a string that supports numeric values. If it is left empty or if a non-numeric value is passed, it defaults to 0.

rest

any

No

Additional parameters such as param1, param2, ..., which are passed to the callback as arguments.

Example

setInterval(() => {
  console.log('setInterval success');
}, 3000, 'param1', 'param2');

clearTimeout

clearTimeout(number timeoutID)

Cancels the timer set by calling setTimeout.

Since: 1.0.0

Parameters

Name

Type

Mandatory

Description

timeoutID

number

Yes

ID of the timer to cancel.

Example

clearTimeout(111);

setTimeout

setTimeout(function callback, number delay, any rest)

Sets a timer.

Since: 1.0.0

Parameters

Name

Type

Mandatory

Description

callback

function

Yes

Callback.

delay

number

Yes

Interval at which the callback is executed, in ms.

It is a string that supports numeric values. If it is left empty or if a non-numeric value is passed, it defaults to 0.

rest

any

No

Additional parameters such as param1, param2, ..., which are passed to the callback as arguments.

Example

setTimeout(() => {
  console.log('setTimeout success');
}, 3000, 'param1', 'param2');