koel/resources/assets/js/services/ls.js

18 lines
284 B
JavaScript
Raw Normal View History

2016-06-25 10:15:57 +00:00
import localStore from 'local-storage';
2015-12-13 04:42:28 +00:00
2016-06-25 10:15:57 +00:00
export const ls = {
2016-06-25 16:05:24 +00:00
get(key, defaultVal = null) {
const val = localStore(key);
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
return val ? val : defaultVal;
},
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
set(key, val) {
return localStore(key, val);
},
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
remove(key) {
return localStore.remove(key);
},
2015-12-13 04:42:28 +00:00
};