persisted-object
v0.0.1
Published
Like a regular js object, only it doesn't go away when you refresh.
Downloads
2
Readme
.---. _ .-. .-. .--. .-. _ .-.
: .; : :_; .' `. : :: ,. :: : :_; .' `.
: _.'.--. .--. .-. .--.`. .'.--. .-' :: :: :: `-. .-. .--. .--.`. .'
: : ' '_.': ..': :`._-.': :' '_.'' .; :: :; :' .; :: :' '_.'' ..': :
:_; `.__.':_; :_;`.__.':_;`.__.'`.__.'`.__.'`.__.': :`.__.'`.__.':_;
.-. :
`._.'
Use it just like a regular javascript object.
var PersistedObject = require('persisted-object');
var foo = new PersistedObject('uniq-foo-key');
if (foo.bar) {
console.log('Bar is: ', foo.bar);
} else {
console.log('Setting bar!!!');
foo.bar = 'baz';
}
When you first load this script, it will say Setting bar!!!
in the console.
Reload the page and it will say Bar is: baz
.
Install it with npm:
npm install persisted-object
or bower:
bower install persisted-object
See the list of supported browsers.