ee-core 1.2.1 → 1.2.2

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/baseApp.js CHANGED
@@ -108,30 +108,6 @@ class BaseApp extends EeAppCore {
108
108
  return this[HTTPCLIENT];
109
109
  }
110
110
 
111
- /**
112
- * 调用 egg api
113
- */
114
- // async curlEgg (method, uri, params, timeout = 15000) {
115
- // let result = null;
116
- // try {
117
- // const port = this.config.egg.port;
118
- // const url = "http://127.0.0.1:" + port + uri;
119
- // // console.log('[ee:baseApp] [curlEgg] url:', url);
120
- // const response = await this.curl(url, {
121
- // method: method,
122
- // contentType: 'application/json',
123
- // data: params,
124
- // dataType: 'json',
125
- // timeout: timeout,
126
- // });
127
- // result = response.data;
128
- // } catch (err) {
129
- // this.logger.error('[ee:baseApp] [curlEgg] throw error:', err);
130
- // }
131
-
132
- // return result;
133
- // }
134
-
135
111
  /**
136
112
  * core app have been loaded
137
113
  */
package/lib/eeApp.js CHANGED
@@ -64,20 +64,13 @@ class EeApp extends BaseApp {
64
64
  }
65
65
 
66
66
  app.on('second-instance', (event) => {
67
- if (self.electron.mainWindow) {
68
- if (self.electron.mainWindow.isMinimized()) {
69
- self.electron.mainWindow.restore();
70
- }
71
- self.electron.mainWindow.focus()
72
- }
67
+ self.restoreMainWindow();
73
68
  })
74
69
 
75
70
  app.whenReady().then(() => {
76
71
  self.createWindow();
77
72
  app.on('activate', function () {
78
- if (BrowserWindow.getAllWindows().length === 0) {
79
- self.createWindow();
80
- }
73
+ self.restoreMainWindow();
81
74
  })
82
75
  })
83
76
 
@@ -91,15 +84,14 @@ class EeApp extends BaseApp {
91
84
  app.on('before-quit', () => {
92
85
  self.electron.extra.closeWindow = true;
93
86
  })
87
+
88
+ await this.electronAppReady();
94
89
  }
95
90
 
96
91
  /**
97
92
  * 创建应用主窗口
98
93
  */
99
94
  async createWindow () {
100
-
101
- await this.electronAppReady();
102
-
103
95
  const winOptions = this.config.windowsOption;
104
96
  this.electron.mainWindow = new BrowserWindow(winOptions);
105
97
 
@@ -122,6 +114,18 @@ class EeApp extends BaseApp {
122
114
  }
123
115
  }
124
116
 
117
+ /**
118
+ * 还原窗口
119
+ */
120
+ restoreMainWindow () {
121
+ if (this.electron.mainWindow) {
122
+ if (this.electron.mainWindow.isMinimized()) {
123
+ this.electron.mainWindow.restore();
124
+ }
125
+ this.electron.mainWindow.show()
126
+ }
127
+ }
128
+
125
129
  /**
126
130
  * 加载已经实现的功能
127
131
  */
@@ -232,12 +236,12 @@ class EeApp extends BaseApp {
232
236
  /**
233
237
  * 限制一个窗口
234
238
  */
235
- async limitOneWindow () {
236
- const gotTheLock = app.requestSingleInstanceLock();
237
- if (!gotTheLock) {
238
- await this.appQuit();
239
- }
240
- }
239
+ // async limitOneWindow () {
240
+ // const gotTheLock = app.requestSingleInstanceLock();
241
+ // if (!gotTheLock) {
242
+ // await this.appQuit();
243
+ // }
244
+ // }
241
245
 
242
246
  /**
243
247
  * electron app退出
@@ -246,7 +250,7 @@ class EeApp extends BaseApp {
246
250
  await this.beforeClose();
247
251
 
248
252
  // 窗口销毁
249
- this.electron.mainWindow.close();
253
+ //this.electron.mainWindow.close();
250
254
 
251
255
  //console.log('Exit now!');
252
256
  // 托盘销毁
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ee-core",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "ee core",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -128,7 +128,9 @@ class CodeCompress {
128
128
  * 移除备份
129
129
  */
130
130
  rmBackup () {
131
- fs.rmdirSync(this.backupCodeDir, {recursive: true});
131
+ if (fs.existsSync(this.backupCodeDir)) {
132
+ fs.rmSync(this.backupCodeDir, {recursive: true, force: true});
133
+ }
132
134
  return;
133
135
  }
134
136