03-03-2020 01:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-03-2020 01:07
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
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.

Accepted Solutions
03-03-2020 09:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



03-03-2020 09:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post



03-03-2020 09:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
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
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-03-2020 23:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks Liam, will try it out and let all know. Cheers

