// 模块
var S = (function(window){
var config = {
key: 'data'
},
api = {
init: init,
set: set,
get: get,
remove: remove
}
function init(){
config = arguments[0] !== (void 0) ? arguments[0] : config;
}
function set(key, value){
key = key || config.key
window.localStorage.setItem(key, value)
}
function get(key){
key = key || config.key
return window.localStorage.getItem(key)
}
function remove(key){
key = key || config.key
window.localStorage.removeItem(key)
}
return api;
})(window)
// S.set('data', 'caoxinjin123456')
S.init({key:'k'})
S.set('k', 'xxx')
console.log(S.get())
console