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

19 lines
351 B
JavaScript
Raw Normal View History

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