const { Application } = require('ee-core'); const HttpServer = require('./server/http'); class Index extends Application { constructor() { super(); // this === eeApp; this.httpServer = new HttpServer(); } /** * core app have been loaded */ async ready () { // do some things } /** * electron app ready */ async electronAppReady () { // do some things } /** * main window have been loaded */ async windowReady () { // do some things // 延迟加载,无白屏 const winOpt = this.config.windowsOption; if (winOpt.show == false) { const win = this.electron.mainWindow; win.once('ready-to-show', () => { win.show(); win.focus(); }) } // 启动HTTP服务 // this.httpServer.start(); } /** * before app close */ async beforeClose () { // do some things // 关闭HTTP服务器 // this.httpServer.stop(); } } Index.toString = () => '[class Index]'; module.exports = Index;