diff --git a/electron/main/index.ts b/electron/main/index.ts index 5f7ba46..07c5e64 100644 --- a/electron/main/index.ts +++ b/electron/main/index.ts @@ -55,6 +55,12 @@ if (!app.requestSingleInstanceLock()) { // process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true' app.whenReady().then(() => { try { + // 禁止多开 + const instanceLock = app.requestSingleInstanceLock(); + if (!instanceLock) { + app.quit(); + return; + } // addon global.addon = require("../../native/addon.node"); // 初始化数据 @@ -78,12 +84,6 @@ app.whenReady().then(() => { return; } } - // 禁止多开 - const instanceLock = app.requestSingleInstanceLock(); - if (!instanceLock) { - app.quit(); - return; - } // 初始化数据 classificationDataInit(); itemDataInit();