Web Storage (API) polyfill. Using following storages in order of priority: localStorage -> cookie -> memory
npm install jwallet-web-storage
const storage = require('jwallet-web-storage')
The (Web Storage API)[https://html.spec.whatwg.org/multipage/webstorage.html] provides mechanisms by which browsers can store key/value pairs.
Adds key
to the storage, or updates that key
's value
if it already exists.
storage.setItem('Key', 'Value')
const objectStorageValue = { foo: 'bar' }
storage.setItem('AnotherKey', JSON.stringify(objectStorageValue))
Returns that key
's value.
storage.getItem('Key') //> Value
JSON.parse(storage.getItem('AnotherKey')) //> { foo: 'bar' }
Removes key
from the storage.
storage.removeItem('Key')
storage.removeItem('AnotherKey')