fix splash screen
This commit is contained in:
parent
854d6dd6a2
commit
c7f91d3e6b
8 changed files with 61 additions and 77 deletions
|
|
@ -55,7 +55,7 @@ const windowMount = (): void => {
|
|||
ipcMain.removeHandler('nav-bar'); // avoid setting duplicate handlers
|
||||
ipcMain.handle('nav-bar', navBarHandler);
|
||||
// render messages through ipc-renderer.
|
||||
backgroundMitt.once('ipc-renderer', renderMessage);
|
||||
backgroundMitt.on('ipc-renderer', renderMessage);
|
||||
}
|
||||
|
||||
// do this on window dismount.
|
||||
|
|
@ -64,7 +64,7 @@ const windowDismount = (): void => {
|
|||
backgroundMitt.emit('window-active', false);
|
||||
}
|
||||
|
||||
// function used by run.ts to create the main window.
|
||||
// function used by run.ts to create the main window.
|
||||
export async function createWindow(options: WindowSettings): Promise<void> {
|
||||
return new Promise((resolve, _reject) => {
|
||||
|
||||
|
|
@ -88,6 +88,7 @@ export async function createWindow(options: WindowSettings): Promise<void> {
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
if (process.env.WEBPACK_DEV_SERVER_URL) {
|
||||
// Load the url of the dev server if in development mode
|
||||
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string);
|
||||
|
|
@ -105,7 +106,10 @@ export async function createWindow(options: WindowSettings): Promise<void> {
|
|||
})
|
||||
|
||||
win.webContents.on('did-finish-load', () => {
|
||||
windowMount();
|
||||
if (win) win.webContents.send('window-ready', {
|
||||
message: true
|
||||
});
|
||||
windowMount();
|
||||
resolve();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue