Skip to content

Commit

Permalink
fix: Workaround to fix child window cannot load issue, might need to …
Browse files Browse the repository at this point in the history
…wait electron to fix this bug
  • Loading branch information
ci010 committed May 7, 2023
1 parent f0f50e9 commit fe0054e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions xmcl-electron-app/main/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default class Controller implements LauncherAppController {
minHeight: 600,
width: 1024,
height: 768,
show: false,

webPreferences: {
contextIsolation: true,
Expand All @@ -81,13 +82,16 @@ export default class Controller implements LauncherAppController {
window.webContents.setWindowOpenHandler(this.windowOpenHandler)
window.webContents.on('will-navigate', this.onWebContentWillNavigate)
window.webContents.on('did-create-window', this.onWebContentCreateWindow)
this.logger.log(`Try to open window ${details.url}`)
window.once('ready-to-show', () => {
window.loadURL(details.url).then(() => {
this.logger.log(`Opened window ${details.url}`)
}, (e) => {
this.logger.log(`Fail to open window ${details.url}`, e)
})
window.show()
})
this.logger.log(`Try to open window ${details.url}`)
window.loadURL(details.url).then(() => {
this.logger.log(`Opened window ${details.url}`)
window.webContents.reload()
}, (e) => {
this.logger.log(`Fail to open window ${details.url}`, e)
window.webContents.reload()
})
}

Expand Down

0 comments on commit fe0054e

Please sign in to comment.