Skip to main content

xnew.timer

xnew.timer create a timer that execute a callback function for a specified time.

xnew.timer(callback, delay);

example

xnew((self) => {
const timer = xnew.timer(() => {
// This function is called after 100 ms.
}, 100);

// If you cancel the timer, call bellow.
// timer.clear();
});

tip

If the parent unit finalize, the timer is automatically cleared.