重启之后清除登录信息
This commit is contained in:
42
test-startup.js
Normal file
42
test-startup.js
Normal file
@@ -0,0 +1,42 @@
|
||||
const { app } = require('electron');
|
||||
const path = require('path');
|
||||
|
||||
console.log('开始测试应用启动...');
|
||||
|
||||
// 模拟应用启动过程
|
||||
app.on('ready', () => {
|
||||
console.log('应用已准备就绪');
|
||||
});
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
console.log('所有窗口已关闭');
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
app.on('before-quit', () => {
|
||||
console.log('应用即将退出');
|
||||
});
|
||||
|
||||
app.on('will-quit', () => {
|
||||
console.log('应用将要退出');
|
||||
});
|
||||
|
||||
// 检查单实例锁
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
console.log('单实例锁检查结果:', gotTheLock);
|
||||
|
||||
if (!gotTheLock) {
|
||||
console.log('检测到已有实例运行,退出当前实例');
|
||||
app.quit();
|
||||
} else {
|
||||
console.log('这是第一个实例,继续启动');
|
||||
|
||||
// 模拟异步操作
|
||||
setTimeout(() => {
|
||||
console.log('异步操作完成');
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
console.log('启动脚本执行完成');
|
||||
Reference in New Issue
Block a user