mirror of
https://gitee.com/dromara/electron-egg.git
synced 2026-05-14 19:52:10 +08:00
update
This commit is contained in:
15
main.js
15
main.js
@@ -1,8 +1,7 @@
|
||||
const {app, BrowserWindow, Menu, shell} = require('electron')
|
||||
const path = require('path')
|
||||
const glob = require('glob')
|
||||
const getPort = require('get-port')
|
||||
const eggLauncher = require('./main/lanucher')
|
||||
const eggLauncher = require('./app/lanucher')
|
||||
|
||||
// glogger
|
||||
global.GLOGGER = require('electron-log')
|
||||
@@ -27,7 +26,7 @@ for (let i = 0; i < process.argv.length; i++) {
|
||||
}
|
||||
GLOGGER.info('options', options);
|
||||
|
||||
if (process.mas) app.setName('box')
|
||||
if (process.mas) app.setName('electron-egg')
|
||||
|
||||
app.on('web-contents-created', (e, webContents) => {
|
||||
webContents.on('new-window', (event, url) => {
|
||||
@@ -39,7 +38,7 @@ app.on('web-contents-created', (e, webContents) => {
|
||||
async function createWindow () {
|
||||
MAIN_WINDOW = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 800,
|
||||
height: 600,
|
||||
minWidth: 800,
|
||||
minHeight: 600,
|
||||
webPreferences: {
|
||||
@@ -61,7 +60,7 @@ async function createWindow () {
|
||||
}
|
||||
|
||||
// loding页
|
||||
MAIN_WINDOW.loadURL(path.join('file://', __dirname, '/index.html'))
|
||||
MAIN_WINDOW.loadURL(path.join('file://', __dirname, '/public/loading.html'))
|
||||
|
||||
// egg服务
|
||||
setTimeout(function(){
|
||||
@@ -92,7 +91,6 @@ async function startServer (options) {
|
||||
}
|
||||
|
||||
async function initialize () {
|
||||
loadDemos()
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
app.on('activate', function () {
|
||||
@@ -110,9 +108,4 @@ async function initialize () {
|
||||
})
|
||||
}
|
||||
|
||||
function loadDemos () {
|
||||
let files = glob.sync(path.join(__dirname, 'main/**/*.js'))
|
||||
files.forEach((file) => { require(file) })
|
||||
}
|
||||
|
||||
initialize()
|
||||
Reference in New Issue
Block a user