This commit is contained in:
哆啦好梦
2023-04-14 16:40:06 +08:00
parent baeec344f9
commit 8907b76a17
4 changed files with 61 additions and 52 deletions

View File

@@ -1,10 +1,16 @@
/**
* 加密配置
* @param type - confusion | bytecode | strict
*/
module.exports = {
type: 'bytecode',
directory: [
'electron'
type: 'confusion',
files: [
'electron/**/*.(js|json)',
'!electron/config/encrypt.js',
'!electron/config/nodemon.json'
],
cleanFiles: [
'electron',
],
fileExt: ['.js'],
confusionOptions: {

48
electron/index.js Normal file
View File

@@ -0,0 +1,48 @@
const { Application } = require('ee-core');
class App extends Application {
constructor() {
super();
}
/**
* 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();
})
}
}
/**
* before app close
*/
async beforeClose () {
// do some things
}
}
App.toString = () => '[class App]';
module.exports = App;

50
main.js
View File

@@ -1,51 +1,5 @@
const { Application } = require('ee-core');
const EE = require('ee-core/ee');
class Main extends Application {
constructor() {
super();
// this === eeApp;
}
/**
* 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();
})
}
}
/**
* before app close
*/
async beforeClose () {
// do some things
}
}
const App = require('./electron');
// Instantiate an app object
EE.app = new Main();
EE.app = new App();

View File

@@ -1,6 +1,6 @@
{
"name": "ee",
"version": "3.0.1",
"version": "3.1.0",
"description": "A fast, desktop software development framework",
"main": "main.js",
"scripts": {
@@ -27,6 +27,7 @@
"build-lp-64": "electron-builder -l=pacman --x64",
"rd": "ee-core rd --dist_dir=./frontend/dist",
"encrypt": "ee-core encrypt",
"clean": "ee-core clean",
"rebuild": "electron-rebuild",
"re-sqlite": "electron-rebuild -f -w better-sqlite3"
},