打包完成后的electron应用,要实现用户5分钟未操作键盘然后让electron做出对应的动作
问题已经解决,感谢大佬回答
#preload.js(渲染进程)
const { remote } = require("electron");
// 获取主进程中的WebContent
const webContents = remote.getCurrentWebContents();
webContents.on("before-input-event", (event, input) => {
#这里可以监听到键盘事件
#定义一个时间戳,用于记入当前时间
});
#定义一个定时器,如果当前时间-之前按下键盘时的时间戳大于或等于5分钟那就执行你想做的事。