NPM
npm i electron-splashscreen
Example
import { initSplashScreen, Office } from 'electron-splashscreen';
import isDev from 'electron-is-dev';
import { resolve } from 'app-root-path';
app.on('ready', async () => {
const mainWindow = new BrowserWindow({
...
});
const hideSplashscreen = initSplashScreen({
mainWindow,
icon: isDev ? resolve('assets/icon.ico') : undefined,
url: Office,
width: 500,
height: 300,
brand: 'My Brand',
productName: 'My App',
logo: resolve('assets/logo.svg'),
website: 'www.my-brand.com',
text: 'Initializing ...'
});
ipcMain.on('ready', hideSplashscreen);
mainWindow.once('ready-to-show', () => {
if (isDev) {
mainWindow.show();
}
});
})