When you change app (e.g. go to settings which is also an app) then all variables, including globals, are deleted and new app starts from empty state. Only way to save data beyond that is to use flash.
You can use kill event to save data when your widget is about to get shut down:
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
When you change app (e.g. go to settings which is also an app) then all variables, including globals, are deleted and new app starts from empty state. Only way to save data beyond that is to use flash.
You can use
kill
event to save data when your widget is about to get shut down: