Files
electron-egg/electron/preload/lifecycle.js
2024-12-22 21:01:10 +08:00

49 lines
754 B
JavaScript

'use strict';
class Lifecycle {
constructor() {
}
/**
* 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();
})
}
}
/**
* before app close
*/
async beforeClose () {
// do some things
}
}
Lifecycle.toString = () => '[class Lifecycle]';
module.exports = Lifecycle;