perf: 90ms improvement: Defer more code in renderer, load state earlier
By deferring more code in the renderer and loading state earlier, we improve startup time by another 90ms! Before: 507 unique requires (1270-1280ms) After: 506 unique requires (1180-1190ms)
This commit is contained in:
@@ -45,18 +45,26 @@ function init (state, options) {
|
||||
y: initialBounds.y
|
||||
})
|
||||
|
||||
win.once('ready-to-show', function () {
|
||||
win.loadURL(config.WINDOW_MAIN)
|
||||
|
||||
win.once('ready-to-show', () => {
|
||||
if (!options.hidden) win.show()
|
||||
})
|
||||
|
||||
win.loadURL(config.WINDOW_MAIN)
|
||||
|
||||
if (win.setSheetOffset) win.setSheetOffset(config.UI_HEADER_HEIGHT)
|
||||
if (win.setSheetOffset) {
|
||||
win.setSheetOffset(config.UI_HEADER_HEIGHT)
|
||||
}
|
||||
|
||||
win.webContents.on('dom-ready', function () {
|
||||
menu.onToggleFullScreen(main.win.isFullScreen())
|
||||
})
|
||||
|
||||
win.webContents.on('will-navigate', (e, url) => {
|
||||
// Prevent drag-and-drop from navigating the Electron window, which can happen
|
||||
// before our drag-and-drop handlers have been initialized.
|
||||
e.preventDefault()
|
||||
})
|
||||
|
||||
win.on('blur', onWindowBlur)
|
||||
win.on('focus', onWindowFocus)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user