You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
// const Store = require('electron-store');
// const store = new Store();//
const data_path = "./data.json"; const fs = require("fs")
class Store { constructor(){ fs.writeFileSync(data_path,JSON.stringify({})) } set(key, param) { // let saveData = {key:param};
console.log("------",key,param); let oldData = require('./data.json'); oldData[key] = param; // console.log('======',oldData);
fs.writeFileSync(data_path,JSON.stringify(oldData)) } get(key){ const data = JSON.parse(fs.readFileSync(data_path,'utf-8')); // console.log('get>>>>>>>>>',data[key])
return data[key]; } delete(key){ let oldData = require('./data.json'); delete oldData[key]; fs.writeFileSync(data_path,JSON.stringify(oldData)) } }
const store = new Store();
module.exports = store
|