forked from Gitlink/forgeplus-react
14 lines
381 B
JavaScript
14 lines
381 B
JavaScript
import store from 'store'
|
|
|
|
export function toStore(key, val) {
|
|
let _config = store.get('__ec');
|
|
if (!_config) _config = {};
|
|
_config[key] = val;
|
|
store.set('__ec', _config)
|
|
}
|
|
|
|
export function fromStore(key, defaultVal) {
|
|
let _config = store.get('__ec');
|
|
if (!_config) return defaultVal;
|
|
return _config[key] === undefined ? defaultVal : _config[key];
|
|
} |