I am confused with the notion of javascript variable lifetime in the context of Cordova applications. When is it ok to assume my javascript variables are defined when an app is running on a mobile device? Is it only when the app is open? Or do they persist when the app is paused?
Asked
Active
Viewed 147 times
1 Answers
2
Basically, its just like a webpage. If you pause the app, then reopen, the variable will still be set. If you fully close the app, (end process), it will not have a value anymore. With web apps, you can use local storage to store variables. http://diveintohtml5.info/storage.html
You can store the variable in local storage and then read it when the app is loaded again. This is only needed for variables that you want to retain values from.

Kalel Wade
- 7,742
- 3
- 39
- 55