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.
49 lines
923 B
JavaScript
49 lines
923 B
JavaScript
const about = module.exports = {
|
|
init,
|
|
win: null
|
|
}
|
|
|
|
const config = require('../../config')
|
|
const electron = require('electron')
|
|
|
|
function init () {
|
|
if (about.win) {
|
|
return about.win.show()
|
|
}
|
|
|
|
const win = about.win = new electron.BrowserWindow({
|
|
backgroundColor: '#ECECEC',
|
|
center: true,
|
|
fullscreen: false,
|
|
height: 170,
|
|
icon: getIconPath(),
|
|
maximizable: false,
|
|
minimizable: false,
|
|
resizable: false,
|
|
show: false,
|
|
skipTaskbar: true,
|
|
title: 'About ' + config.APP_WINDOW_TITLE,
|
|
useContentSize: true,
|
|
width: 300
|
|
})
|
|
|
|
win.loadURL(config.WINDOW_ABOUT)
|
|
|
|
// No menu on the About window
|
|
win.setMenu(null)
|
|
|
|
win.once('ready-to-show', function () {
|
|
win.show()
|
|
})
|
|
|
|
win.once('closed', function () {
|
|
about.win = null
|
|
})
|
|
}
|
|
|
|
function getIconPath () {
|
|
return process.platform === 'win32'
|
|
? config.APP_ICON + '.ico'
|
|
: config.APP_ICON + '.png'
|
|
}
|