2016-11-26 03:25:35 +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-11-26 03:25:35 +00:00
|
|
|
get (key, defaultVal = null) {
|
|
|
|
const val = localStore(key)
|
2015-12-13 04:42:28 +00:00
|
|
|
|
2016-11-26 03:25:35 +00:00
|
|
|
return val || defaultVal
|
2016-06-25 16:05:24 +00:00
|
|
|
},
|
2015-12-13 04:42:28 +00:00
|
|
|
|
2016-11-26 03:25:35 +00:00
|
|
|
set (key, val) {
|
|
|
|
return localStore(key, val)
|
2016-06-25 16:05:24 +00:00
|
|
|
},
|
2015-12-13 04:42:28 +00:00
|
|
|
|
2016-11-26 03:25:35 +00:00
|
|
|
remove (key) {
|
|
|
|
return localStore.remove(key)
|
|
|
|
}
|
|
|
|
}
|