Hello,
I have a ionic mobile application that displays a chronometer.
When i launch the chronometer, it stops when i lock the device or when i change the application then return to the chronometer.
How can I make the chronometer continue normally please ?
Here is the chronometer code in my angular 4 component
Thank you in advance.
/**
* chronometre
* */
chronometer(): void {
if (this.startchron == 1) {
this.chronoTimer.tenthOfSecond += 1;
// set seconds
if (this.chronoTimer.tenthOfSecond > 9) {
this.chronoTimer.tenthOfSecond = 0;
this.chronoTimer.seconds += 1;
}
// set minutes
if (this.chronoTimer.seconds > 59) {
this.chronoTimer.seconds = 0;
this.chronoTimer.minutes += 1;
}
setTimeout(() => this.chronometer(), 100);
}
}