Wait for 'ready-to-show' event before showing window (#959)
This gets rid of the light gray to dark gray background color change on the main window at startup. Makes the window show slightly later, but it's gray for less time. Doesn't affect overall startup time. Feels less jank IMO. From the Electron docs: > While loading the page, the 'ready-to-show' event will be emitted when renderer process has done drawing for the first time, showing window after this event will have no visual flash.
This commit is contained in:
@@ -38,13 +38,17 @@ function init (state, options) {
|
||||
title: config.APP_WINDOW_TITLE,
|
||||
titleBarStyle: 'hidden-inset', // Hide title bar (Mac)
|
||||
useContentSize: true, // Specify web page size without OS chrome
|
||||
show: !options.hidden,
|
||||
show: false,
|
||||
width: initialBounds.width,
|
||||
height: initialBounds.height,
|
||||
x: initialBounds.x,
|
||||
y: initialBounds.y
|
||||
})
|
||||
|
||||
win.once('ready-to-show', function () {
|
||||
if (!options.hidden) win.show()
|
||||
})
|
||||
|
||||
win.loadURL(config.WINDOW_MAIN)
|
||||
|
||||
if (win.setSheetOffset) win.setSheetOffset(config.UI_HEADER_HEIGHT)
|
||||
|
||||
Reference in New Issue
Block a user