ee-core 1.1.6 → 1.1.7
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 +12 -58
- package/package.json +1 -1
package/lib/eeApp.js
CHANGED
|
@@ -79,6 +79,9 @@ class EeApp extends BaseApp {
|
|
|
79
79
|
* 创建应用主窗口
|
|
80
80
|
*/
|
|
81
81
|
async createWindow () {
|
|
82
|
+
|
|
83
|
+
await this.electronAppReady();
|
|
84
|
+
|
|
82
85
|
const winOptions = this.config.windowsOption;
|
|
83
86
|
this.electron.mainWindow = new BrowserWindow(winOptions);
|
|
84
87
|
|
|
@@ -109,34 +112,6 @@ class EeApp extends BaseApp {
|
|
|
109
112
|
return await preferences(this);
|
|
110
113
|
}
|
|
111
114
|
|
|
112
|
-
/**
|
|
113
|
-
* 创建egg服务
|
|
114
|
-
*/
|
|
115
|
-
// async startEggServer () {
|
|
116
|
-
// // egg服务是否开启
|
|
117
|
-
// if (this.config.egg.enable == false) {
|
|
118
|
-
// return;
|
|
119
|
-
// }
|
|
120
|
-
// let eggConfig = this.config.egg;
|
|
121
|
-
// const protocol = 'http://';
|
|
122
|
-
// let startRes = null;
|
|
123
|
-
// let url = protocol + eggConfig.hostname + ':' + eggConfig.port;
|
|
124
|
-
|
|
125
|
-
// startRes = await this.startEgg(eggConfig).then((res) => res, (err) => err);
|
|
126
|
-
// this.coreLogger.info('[ee-core:EeApp] [startEggServer] startRes:', startRes)
|
|
127
|
-
// if (startRes === 'success') {
|
|
128
|
-
// // 如果加载远程网址,则不能重复load
|
|
129
|
-
// const remoteConfig = this.config.remoteUrl;
|
|
130
|
-
// if (remoteConfig.enable) {
|
|
131
|
-
// return;
|
|
132
|
-
// }
|
|
133
|
-
// this.loadMainUrl('egg', url);
|
|
134
|
-
// } else {
|
|
135
|
-
// // 失败后重启
|
|
136
|
-
// app.relaunch();
|
|
137
|
-
// }
|
|
138
|
-
// }
|
|
139
|
-
|
|
140
115
|
/**
|
|
141
116
|
* 加载loading页面
|
|
142
117
|
*/
|
|
@@ -233,37 +208,8 @@ class EeApp extends BaseApp {
|
|
|
233
208
|
loadMainUrl (type, url) {
|
|
234
209
|
this.logger.info('main page is env: %s, type: %s, url: %s', this.config.env, type, url);
|
|
235
210
|
this.electron.mainWindow.loadURL(url);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* egg
|
|
240
|
-
*/
|
|
241
|
-
// startEgg (argv) {
|
|
242
|
-
|
|
243
|
-
// let homeDir = this.homeDir;
|
|
244
|
-
// argv.baseDir = homeDir;
|
|
245
|
-
// argv.framework = path.join(homeDir, 'node_modules', 'egg');
|
|
246
|
-
|
|
247
|
-
// const appName = this.config.name;
|
|
248
|
-
// argv.title = argv.title || `egg-server-${appName}`;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
// // normalize env
|
|
252
|
-
// // 目前没有用到,不用修改;想要修改的话,区分打包前后的路径?
|
|
253
|
-
// // env.HOME = HOME; // 这个home不能修改,因为自动升级功能会用到(win没有问题,mac有权限问题)
|
|
254
|
-
// //env.NODE_ENV = 'production';
|
|
255
|
-
|
|
256
|
-
// // 更新缓存配置
|
|
257
|
-
// this.getCoreDB().setItem('config', this.config);
|
|
211
|
+
}
|
|
258
212
|
|
|
259
|
-
// const ignoreKeys = [ '_', '$0', 'env', 'daemon', 'stdout', 'stderr', 'timeout', 'ignore-stderr', 'node' ];
|
|
260
|
-
// const clusterOptions = this.stringify(argv, ignoreKeys);
|
|
261
|
-
// const options = JSON.parse(clusterOptions);
|
|
262
|
-
// this.coreLogger.info('[ee-core:EeApp] [startEgg] options', options);
|
|
263
|
-
// if (is.function(this.startEggCluster)) {
|
|
264
|
-
// return this.startEggCluster(options);
|
|
265
|
-
// }
|
|
266
|
-
// }
|
|
267
213
|
|
|
268
214
|
/**
|
|
269
215
|
* 限制一个窗口
|
|
@@ -337,6 +283,14 @@ class EeApp extends BaseApp {
|
|
|
337
283
|
// });
|
|
338
284
|
}
|
|
339
285
|
|
|
286
|
+
/**
|
|
287
|
+
* electron app已经准备好,主窗口还未创建
|
|
288
|
+
*/
|
|
289
|
+
async electronAppReady () {
|
|
290
|
+
// do some things
|
|
291
|
+
|
|
292
|
+
}
|
|
293
|
+
|
|
340
294
|
/**
|
|
341
295
|
* 主应用窗口已经创建
|
|
342
296
|
*/
|