mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 19:52:10 +08:00
chore: test config \ lifecycle
This commit is contained in:
@@ -6,135 +6,65 @@ const path = require('path');
|
||||
* 默认配置
|
||||
*/
|
||||
module.exports = (appInfo) => {
|
||||
const config = {};
|
||||
|
||||
/**
|
||||
* 开发者工具
|
||||
*/
|
||||
config.openDevTools = false;
|
||||
|
||||
/**
|
||||
* 主窗口
|
||||
*/
|
||||
config.windowsOption = {
|
||||
title: 'EE框架',
|
||||
width: 980,
|
||||
height: 650,
|
||||
minWidth: 400,
|
||||
minHeight: 300,
|
||||
webPreferences: {
|
||||
//webSecurity: false,
|
||||
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
||||
nodeIntegration: true,
|
||||
//preload: path.join('preload', 'bridge.js'),
|
||||
return {
|
||||
openDevTools: false,
|
||||
windowsOption: {
|
||||
title: 'electron-egg1',
|
||||
width: 980,
|
||||
height: 650,
|
||||
minWidth: 400,
|
||||
minHeight: 300,
|
||||
webPreferences: {
|
||||
//webSecurity: false,
|
||||
contextIsolation: false, // false -> 可在渲染进程中使用electron的api,true->需要bridge.js(contextBridge)
|
||||
nodeIntegration: true,
|
||||
//preload: path.join(appInfo.electronDir, 'preload', 'bridge.js'),
|
||||
},
|
||||
frame: true,
|
||||
show: false,
|
||||
icon: path.join(appInfo.baseDir, 'public', 'images', 'logo-32.png'),
|
||||
},
|
||||
frame: true,
|
||||
show: false,
|
||||
icon: path.join('public', 'images', 'logo-32.png'),
|
||||
};
|
||||
|
||||
/**
|
||||
* ee框架日志
|
||||
*/
|
||||
config.logger = {
|
||||
encoding: 'utf8',
|
||||
level: 'INFO',
|
||||
outputJSON: false,
|
||||
buffer: true,
|
||||
enablePerformanceTimer: false,
|
||||
rotator: 'day',
|
||||
appLogName: 'ee.log',
|
||||
coreLogName: 'ee-core.log',
|
||||
errorLogName: 'ee-error.log'
|
||||
}
|
||||
|
||||
/**
|
||||
* 远程模式-web地址
|
||||
*/
|
||||
config.remoteUrl = {
|
||||
enable: false,
|
||||
url: 'http://electron-egg.kaka996.com/'
|
||||
};
|
||||
|
||||
/**
|
||||
* 内置socket服务
|
||||
*/
|
||||
config.socketServer = {
|
||||
enable: false,
|
||||
port: 7070,
|
||||
path: "/socket.io/",
|
||||
connectTimeout: 45000,
|
||||
pingTimeout: 30000,
|
||||
pingInterval: 25000,
|
||||
maxHttpBufferSize: 1e8,
|
||||
transports: ["polling", "websocket"],
|
||||
cors: {
|
||||
origin: true,
|
||||
logger: {
|
||||
level: 'INFO',
|
||||
outputJSON: false,
|
||||
appLogName: 'ee.log',
|
||||
coreLogName: 'ee-core.log',
|
||||
errorLogName: 'ee-error.log'
|
||||
},
|
||||
channel: 'c1'
|
||||
};
|
||||
|
||||
/**
|
||||
* 内置http服务
|
||||
*/
|
||||
config.httpServer = {
|
||||
enable: false,
|
||||
https: {
|
||||
enable: false,
|
||||
key: '/public/ssl/localhost+1.key',
|
||||
cert: '/public/ssl/localhost+1.pem'
|
||||
remoteUrl: {
|
||||
enable: false,
|
||||
url: 'http://electron-egg.kaka996.com/'
|
||||
},
|
||||
host: '127.0.0.1',
|
||||
port: 7071,
|
||||
cors: {
|
||||
origin: "*"
|
||||
socketServer: {
|
||||
enable: false,
|
||||
port: 8080,
|
||||
path: "/socket.io/",
|
||||
connectTimeout: 45000,
|
||||
pingTimeout: 30000,
|
||||
pingInterval: 25000,
|
||||
maxHttpBufferSize: 1e8,
|
||||
transports: ["polling", "websocket"],
|
||||
cors: {
|
||||
origin: false,
|
||||
},
|
||||
channel: 'c1'
|
||||
},
|
||||
body: {
|
||||
multipart: true,
|
||||
formidable: {
|
||||
keepExtensions: true
|
||||
httpServer: {
|
||||
enable: false,
|
||||
https: {
|
||||
enable: false,
|
||||
key: '/public/ssl/localhost+1.key',
|
||||
cert: '/public/ssl/localhost+1.pem'
|
||||
},
|
||||
host: '127.0.0.1',
|
||||
port: 7071,
|
||||
cors: {
|
||||
origin: "*"
|
||||
}
|
||||
},
|
||||
filterRequest: {
|
||||
uris: [
|
||||
'favicon.ico'
|
||||
],
|
||||
returnData: ''
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 主进程
|
||||
*/
|
||||
config.mainServer = {
|
||||
protocol: 'file://',
|
||||
indexPath: '/public/dist/index.html',
|
||||
};
|
||||
|
||||
/**
|
||||
* 硬件加速
|
||||
*/
|
||||
config.hardGpu = {
|
||||
enable: true
|
||||
};
|
||||
|
||||
/**
|
||||
* 异常捕获
|
||||
*/
|
||||
config.exception = {
|
||||
mainExit: false,
|
||||
childExit: true,
|
||||
rendererExit: true,
|
||||
};
|
||||
|
||||
/**
|
||||
* jobs
|
||||
*/
|
||||
config.jobs = {
|
||||
messageLog: true
|
||||
};
|
||||
|
||||
return {
|
||||
...config
|
||||
};
|
||||
mainServer: {
|
||||
protocol: 'file://',
|
||||
indexPath: '/public/dist/index.html',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 开发环境配置,覆盖 config.default.js
|
||||
* Development environment configuration, coverage config.default.js
|
||||
*/
|
||||
module.exports = () => {
|
||||
const config = {};
|
||||
|
||||
/**
|
||||
* 开发者工具
|
||||
*/
|
||||
config.openDevTools = {
|
||||
mode: 'undocked'
|
||||
};
|
||||
|
||||
/**
|
||||
* 内置socket服务
|
||||
*/
|
||||
config.socketServer = {
|
||||
enable: false,
|
||||
port: 7071,
|
||||
path: "/socket.io/",
|
||||
connectTimeout: 45000,
|
||||
pingTimeout: 30000,
|
||||
pingInterval: 25000,
|
||||
maxHttpBufferSize: 1e8,
|
||||
transports: ["polling", "websocket"],
|
||||
cors: {
|
||||
origin: false,
|
||||
},
|
||||
channel: 'c1'
|
||||
};
|
||||
|
||||
return {
|
||||
...config
|
||||
openDevTools: {
|
||||
mode: 'undocked'
|
||||
},
|
||||
jobs: {
|
||||
messageLog: false
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,42 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* 开发环境配置,覆盖 config.default.js
|
||||
* coverage config.default.js
|
||||
*/
|
||||
module.exports = () => {
|
||||
const config = {};
|
||||
|
||||
/**
|
||||
* 开发者工具
|
||||
*/
|
||||
config.openDevTools = {
|
||||
mode: 'undocked'
|
||||
};
|
||||
|
||||
/**
|
||||
* 应用程序顶部菜单
|
||||
*/
|
||||
config.openAppMenu = false;
|
||||
|
||||
/**
|
||||
* 内置socket服务
|
||||
*/
|
||||
config.socketServer = {
|
||||
enable: false,
|
||||
port: 7071,
|
||||
path: "/socket.io/",
|
||||
connectTimeout: 45000,
|
||||
pingTimeout: 30000,
|
||||
pingInterval: 25000,
|
||||
maxHttpBufferSize: 1e8,
|
||||
transports: ["polling", "websocket"],
|
||||
cors: {
|
||||
origin: false,
|
||||
},
|
||||
channel: 'c1'
|
||||
};
|
||||
|
||||
return {
|
||||
...config
|
||||
openDevTools: false,
|
||||
};
|
||||
};
|
||||
|
||||
18
electron/controller/child/friend/school.js
Normal file
18
electron/controller/child/friend/school.js
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* school
|
||||
* @class
|
||||
*/
|
||||
class SchoolController {
|
||||
|
||||
/**
|
||||
* test
|
||||
*/
|
||||
async test () {
|
||||
return 'hello electron-egg';
|
||||
}
|
||||
}
|
||||
|
||||
SchoolController.toString = () => '[class SchoolController]';
|
||||
module.exports = SchoolController;
|
||||
@@ -1,5 +1,8 @@
|
||||
const { ElectronEgg } = require('ee-core');
|
||||
const Lifecycle = require('./preload/lifecycle');
|
||||
|
||||
const app = new ElectronEgg();
|
||||
const lifecycle = new Lifecycle();
|
||||
app.register("ready", lifecycle.ready());
|
||||
|
||||
app.run();
|
||||
@@ -1,10 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
class Index {
|
||||
class Lifecycle {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
// this === eeApp;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,5 +45,5 @@ class Index {
|
||||
}
|
||||
}
|
||||
|
||||
Index.toString = () => '[class Index]';
|
||||
module.exports = Index;
|
||||
Lifecycle.toString = () => '[class Lifecycle]';
|
||||
module.exports = Lifecycle;
|
||||
@@ -46,7 +46,7 @@
|
||||
"license": "Apache",
|
||||
"devDependencies": {
|
||||
"cross-env": "^7.0.3",
|
||||
"debug": "^4.3.7",
|
||||
"debug": "^4.4.0",
|
||||
"ee-bin": "file:.yalc/ee-bin",
|
||||
"ee-bin-ts": "file:.yalc/ee-bin-ts",
|
||||
"electron": "^29.4.0",
|
||||
@@ -55,7 +55,6 @@
|
||||
"dependencies": {
|
||||
"dayjs": "^1.11.13",
|
||||
"ee-core": "file:.yalc/ee-core",
|
||||
"ee-core-ts": "file:.yalc/ee-core-ts",
|
||||
"electron-updater": "^6.3.8"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user