Adds a library of TypeScript which stores and persists application state.
- Automatic save and restore of application state on suspend and resume.
Run the following in a Bash shell at the root of your project:
git submodule add https://github.com/sunruse/dreck-state-plugin plugins/state
const stateManager = new StateManager<AJsonSerializableTypeDescribingTheState>(
`a key which uniquely identifies this piece of state in local storage`,
`a key which is checked when restoring state; if this differs, new state is initialized instead (for breaking changes)`,
{ content: `an initial value for when state is initialized rather than restored` }
);
// "stateManager.state" now contains either the initial value, or a value restored from local storage.
// It will be automatically saved back to local storage when the tab is closed.