ee-core 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/eeApp.js +15 -3
- package/package.json +1 -1
package/lib/eeApp.js
CHANGED
|
@@ -12,7 +12,10 @@ class EeApp extends BaseApp {
|
|
|
12
12
|
|
|
13
13
|
this.electron = {
|
|
14
14
|
mainWindow: null,
|
|
15
|
-
tray: null
|
|
15
|
+
tray: null,
|
|
16
|
+
extra: {
|
|
17
|
+
closeWindow: false,
|
|
18
|
+
}
|
|
16
19
|
};
|
|
17
20
|
}
|
|
18
21
|
|
|
@@ -53,7 +56,12 @@ class EeApp extends BaseApp {
|
|
|
53
56
|
*/
|
|
54
57
|
async createElectronApp () {
|
|
55
58
|
const self = this;
|
|
56
|
-
|
|
59
|
+
|
|
60
|
+
const gotTheLock = app.requestSingleInstanceLock();
|
|
61
|
+
if (!gotTheLock) {
|
|
62
|
+
await this.appQuit();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
57
65
|
|
|
58
66
|
app.on('second-instance', (event) => {
|
|
59
67
|
if (self.electron.mainWindow) {
|
|
@@ -79,6 +87,10 @@ class EeApp extends BaseApp {
|
|
|
79
87
|
self.appQuit();
|
|
80
88
|
}
|
|
81
89
|
})
|
|
90
|
+
|
|
91
|
+
app.on('before-quit', () => {
|
|
92
|
+
self.electron.extra.closeWindow = true;
|
|
93
|
+
})
|
|
82
94
|
}
|
|
83
95
|
|
|
84
96
|
/**
|
|
@@ -234,7 +246,7 @@ class EeApp extends BaseApp {
|
|
|
234
246
|
await this.beforeClose();
|
|
235
247
|
|
|
236
248
|
// 窗口销毁
|
|
237
|
-
this.electron.mainWindow.
|
|
249
|
+
this.electron.mainWindow.close();
|
|
238
250
|
|
|
239
251
|
//console.log('Exit now!');
|
|
240
252
|
// 托盘销毁
|