Intervals (Time events)
Interval events (Timing functions in JavaScript) allow the user to periodically run APIs and DB queries. You can configure these by using the setInterval and clearInterval functions.

setInterval()

The setInterval() method executes a code snippet with a fixed time interval between the calls, i.e, it executes a trigger callback at a given interval. Here’s how you can use it while dynamically binding queries onto widgets:
1
//Syntax
2
setInterval(callbackFunction: Function, interval: number, id?: string)
3
4
// Example
5
setInterval(() => { Query1.run() }, 10000, "myTimer");
Copied!

clearInterval()

The clearInterval() function stops executing the trigger callback started with the setInterval method.
1
//Syntax
2
clearInterval(id: string)
3
4
// Example
5
clearInterval("myTimer");
Copied!
Copy link
Edit on GitHub