03-03-2020 01:07
03-03-2020 01:07
Hi,
Developed a clockface with global variable that increases onclick of a button.
Works perfectly until I move to a new screen - for example swipe upward then select back button, then the variable is reset. Is there a way to keep the variable value after returning to the clockface?
let amountX = 0;
mybutton.onclick = function (e) {
amountX++;
}
Answered! Go to the Best Answer.
03-03-2020 09:05
03-03-2020 09:05
When you swipe up, your clock gets closed and another app gets opened. Pressing back closes that app and re-launches your clock. If you want to maintain state, you need to save it to a file using the FS API.
03-03-2020 09:05
03-03-2020 09:05
When you swipe up, your clock gets closed and another app gets opened. Pressing back closes that app and re-launches your clock. If you want to maintain state, you need to save it to a file using the FS API.
03-03-2020 23:40
03-03-2020 23:40
Thanks Liam, will try it out and let all know. Cheers