mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-23 20:28:10 +08:00
使用新语法
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
const getPort = require('get-port');
|
||||
const server = require("./server");
|
||||
const electronApp = require('electron').app;
|
||||
const { app: electronApp } = require('electron');
|
||||
const Log = require('ee-core/log');
|
||||
const Conf = require('ee-core/config');
|
||||
|
||||
/**
|
||||
* java server插件
|
||||
@@ -11,8 +12,8 @@ class JavaServerAddon {
|
||||
|
||||
constructor(app) {
|
||||
this.app = app;
|
||||
this.cfg = app.config.addons.javaServer;
|
||||
this.javaServer = null;
|
||||
this.cfg;
|
||||
this.javaServer;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -22,10 +23,12 @@ class JavaServerAddon {
|
||||
* @since 1.0.0
|
||||
*/
|
||||
async createServer () {
|
||||
|
||||
this.cfg = Conf.getValue('addons.javaServer');
|
||||
await this.createJavaPorts();
|
||||
|
||||
this.javaServer = new server(this.app);
|
||||
await this.javaServer.create();
|
||||
this.javaServer = new server();
|
||||
await this.javaServer.create(this.cfg);
|
||||
|
||||
// kill
|
||||
electronApp.on("before-quit", async () => {
|
||||
@@ -61,7 +64,7 @@ class JavaServerAddon {
|
||||
this.cfg.port = javaPort;
|
||||
|
||||
// 更新config配置
|
||||
this.app.getCoreDB().setItem("config", this.app.config);
|
||||
Conf.setValue('addons.javaServer', this.cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user