EasyManua.ls Logo

Embedded Systems LogicMachine5 - Page 59

Default Icon
291 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
59
localStorage wrapper functions
localStorage allows saving client-side configuration. Several functions are provided to safely execute
localStorage functions, as they might fail is some cases like private mode on iOS. It also allows storing
any values that can be serialized using JSON.stringify.
storeSet(key, value) sets key/value pair
storeGet(key) retrieves key value, returns null when key is not found
storeRemove(key) removes key from storage
Storage keys must be prefixed with unique application name to minimize collisions between different
applications
Examples
Get currently selected theme (light/dark)
var theme = storeGet('theme') || 'light';
Store JavaScript objects
var user = { name: 'John', surname: 'Doe', age: 42 };
storeSet('myapp_user', user);

Table of Contents

Other manuals for Embedded Systems LogicMachine5

Related product manuals