Local storage in anywhere.
<script type="text/javascript" src="/path/to/lookie.js"></script>
First, setup your lookie storage.
var lookie = new Lookie('namespace');
lookie.set('foo', anyObject);
lookie.get('foo'); // => anyObject
lookie.del('foo');
lookie.get('foo'); // => null or undefined
lookie.exists('foo'); // => false
lookie.set('foo', 1);
lookie.exists('foo'); // => true
lookie.keys(); // => []
lookie.set('foo', 1);
lookie.keys(); // => ['foo']
lookie.set('foo', 1);
lookie.keys(); // => ['foo']
looke.clear();
lookie.keys(); // => []
lookie.on('add', function(key, newValue) {
console.log(key);
});
lookie.on('change', function(key, newValue, oldValue) {
console.log(key);
});
lookie.on('del', function(key) {
console.log(key);
});
MIT License