Merge branch 'master' of github.com:jooy2/vutron
This commit is contained in:
commit
107d8313c6
2 files changed
+14
-8
No files matched your search
+12
-3
@@ -48,12 +48,16 @@ export const createMainWindow = async (mainWindow) => {
|
|||||||
electronRemote.initialize()
|
electronRemote.initialize()
|
||||||
})
|
})
|
||||||
|
|
||||||
await mainWindow.loadURL(`${Constants.APP_INDEX_URL}`)
|
if (Constants.IS_DEV_ENV) {
|
||||||
|
await mainWindow.loadURL(Constants.APP_INDEX_URL_DEV)
|
||||||
|
} else {
|
||||||
|
await mainWindow.loadFile(Constants.APP_INDEX_URL_PROD)
|
||||||
|
}
|
||||||
|
|
||||||
return mainWindow
|
return mainWindow
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createErrorWindow = (errorWindow, mainWindow, details) => {
|
export const createErrorWindow = async (errorWindow, mainWindow, details) => {
|
||||||
if (!Constants.IS_DEV_ENV) {
|
if (!Constants.IS_DEV_ENV) {
|
||||||
mainWindow?.hide()
|
mainWindow?.hide()
|
||||||
}
|
}
|
||||||
@@ -67,7 +71,12 @@ export const createErrorWindow = (errorWindow, mainWindow, details) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
errorWindow.setMenu(null)
|
errorWindow.setMenu(null)
|
||||||
errorWindow.loadURL(`${Constants.APP_INDEX_URL}#/error`).then(() => true)
|
|
||||||
|
if (Constants.IS_DEV_ENV) {
|
||||||
|
await errorWindow.loadURL(`${Constants.APP_INDEX_URL_DEV}#/error`)
|
||||||
|
} else {
|
||||||
|
await errorWindow.loadFile(Constants.APP_INDEX_URL_PROD, { hash: 'error' })
|
||||||
|
}
|
||||||
|
|
||||||
errorWindow.on('ready-to-show', () => {
|
errorWindow.on('ready-to-show', () => {
|
||||||
if (!Constants.IS_DEV_ENV && mainWindow && !mainWindow.isDestroyed()) {
|
if (!Constants.IS_DEV_ENV && mainWindow && !mainWindow.isDestroyed()) {
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import { join } from 'path'
|
|
||||||
import { platform } from 'os'
|
import { platform } from 'os'
|
||||||
import { app } from 'electron'
|
|
||||||
|
|
||||||
export default class Constants {
|
export default class Constants {
|
||||||
static APP_NAME = 'Vutron'
|
static APP_NAME = 'Vutron'
|
||||||
@@ -17,7 +15,6 @@ export default class Constants {
|
|||||||
enableRemoteModule: true
|
enableRemoteModule: true
|
||||||
}
|
}
|
||||||
|
|
||||||
static APP_INDEX_URL = process.env.NODE_ENV === 'development'
|
static APP_INDEX_URL_DEV = 'http://localhost:9080/index.html'
|
||||||
? 'http://localhost:9080/index.html'
|
static APP_INDEX_URL_PROD = './dist/electron/index.html'
|
||||||
: join('file://', app.getAppPath(), '/dist/electron/index.html')
|
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user