I am new to enyo. I want to save a state of variable (which is boolean) while app executes. Then exit the app. After that I want to get the state (true/false) of the variable when app re-opens. How to save and restore the data in enyo?
I would use localStorage (API Docs here) to save your state every time the change in state occurs in your application:
myStateChange: function() {
localStorage.myState = this.myState;
}
Note: to ensure that myStateChange is called every time you set it elsewhere, use this.set() method to set it, not this.myState = newValue;.
Then, in rendered() or create() method I would restore that state from localStorage.
rendered: function() {
this.inherited(arguments); // Call base rendered method
this.myState = localStorage.myState; // Restore your saved value from localStorage
}