clearInterval()
Overview
Clears a timer started with setInterval().
Added in version 2.1.5
Format
clearInterval(timerId);
Value | Description | Type | Required |
---|---|---|---|
timerId | The timer number to be cleared. The same number returned by setInterval(). | Integer | Required |
Example
Copy
/* Play a frog sound three times with 15 seconds between each sound.
*/
var count = 3;
var id = setInterval(function() {
Device.beepPlayFile('frog.mp3');
count--;
if(count <= 0) {
clearInterval(id);
}
}, 15000);