NativeScript Angular

In this article
API Reference
Not finding the help you need?

Timer

Timer Module

Set Interval

Timer method setInterval can be used to apply recurring action on given interval in miliseconds

TypeScript

this.id = setInterval(() => {
    let randNumber = Math.floor(Math.random() * (that.color.length));
    that.buttoncolor = that.color[randNumber];
}, 1000);

Improve this document

Demo Source


Set Timeout

Timer method setTimeout can be used to delay the execution of an action in miliseconds.

TypeScript

setTimeout(() => {
    this.counter--;
    button.backgroundColor = new Color("#30BCFF");
}, 1000);

Improve this document

Demo Source


API Reference for the Timer Class