open-vault/ui/app/lib/memory-storage.js

21 lines
286 B
JavaScript
Raw Normal View History

2018-04-03 14:16:57 +00:00
let cache = {};
export default {
getItem(key) {
var item = cache[key];
return item && JSON.parse(item);
},
setItem(key, val) {
cache[key] = JSON.stringify(val);
},
removeItem(key) {
delete cache[key];
},
keys() {
return Object.keys(cache);
},
};