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.
 
 
 
 

24 lines
672 B

import { ipcMain } from "electron"
import fs from "fs-extra"
import path from "path"
const homeDir = require("os").homedir()
const clockJsonPath = path.resolve(homeDir, ".forceClock/clock.json")
fs.ensureFileSync(clockJsonPath)
try {
console.log(fs.readJSONSync(clockJsonPath))
const job = schedule.scheduleJob('42 * * * *', function(){
console.log('The answer to life, the universe, and everything!');
});
} catch (e) {
console.log(e)
// 读取JSON文件失败
}
ipcMain.on("@func:clock:saveData", function(event, data) {
fs.writeJson(clockJsonPath, data)
})
ipcMain.handle("@func:clock:getData", function() {
return fs.readJSONSync(clockJsonPath)
})