playground.memorycard
A plugin for Playground to allow persistence.
Installation
Either
npm install --save playground.memorycard
or
bower install --save playground.memorycard
Usage
It is an easy access to LocalStorage.
It will load defaults from data/defaults.json
if needed and add them to the localStorage if they're not yet defined.
The plugin is accessible via app.memorycard
var memory = appmemorycard;
getAll()
Will return all data stored as an Object.
memory;
save(key, value, overwrite)
Will store the data under 'key' you can also pass an Object, to batch store data.
By default it doesn't overwrite the data.
memory;memory; // Will be JSON.stringifymemory; // Will store 'test1' and 'test2'
load(key)
Will return the data stored under 'key' or all if no argument is passed.
memory; // {"can": "be an object"} is JSON.parsememory; // memory.getAll();
wipe(key)
Will erase the data under 'key' or all if no argument is passed.
memory;memory;