Tip
We've created a new secure safe-encrypted-storage npm package, you should migrate
storage.js is a simple abstraction of the browser localStorage API
storage.js is built on a module reveal pattern exposing three (3) core methods.
- data()
- remove()
- clear()
the data method can be called as a setter or getter
/*
@param property {string} string name of property
@param value {string|number|object|function|array|json} value of named property
@description creates (if non existant property) or sets value to existing property
@description value can be anything (string, number, object, function, array)
*/
data(property, value)
/*
@param property {string} string name of property to return value of
@return value of named property, false if not found
*/
data(property)
/*
@param property {string} string name of property to remove from storage
*/
remove(property)
/*
@description clears localStorage object completely. good for ending sessions.
*/
clear()