1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| const lsObj = { setItem: function (key, value) { localStorage.setItem(key, JSON.stringify(value)); }, getItem: function (key, def = "") { const item = localStorage.getItem(key); if (item) { return JSON.parse(item); } return def; }, };
const gob = { curPlugList: null, lstPlugList: null, hisPlugList: null, lsKey: { lst: "lstPlugList", his: "hisPlugList", }, load: function (lstDef, hisDef) { this.lstPlugList = lsObj.getItem(this.lsKey.lst, lstDef); this.hisPlugList = lsObj.getItem(this.lsKey.his, hisDef); }, save: function () { lsObj.setItem(this.lsKey.lst, this.lstPlugList); lsObj.setItem(this.lsKey.his, this.hisPlugList); }, };
|