Create splash screen in the Electron application

1

I need to create a kind of Splash Screen for an application on Electron. The organization would look something like this:

Inicialização do App;
Abrir a splashWindow (uma página frameless) por 3 segundos;
Abrir a mainWindow normalmente.

Remembering that mainWindow pulls the link link then I do not have access to the page itself. The splashWindow is local.

Is there any kind of second counter on Electron?

    
asked by anonymous 11.01.2017 / 18:29

1 answer

2

You should do something like this.

First the main screen should be hidden.

mainWindow = new BrowserWindow({titleBarStyle: 'hidden',
     width: 1200,
     height: 800,
     show: false
 })

Next create and show a new window for Splash

var splash = new BrowserWindow({ width: 500, height: 300 });

Once the app is ready to boot. You can use a simple setTimeout :

 mainWindow.once('ready-to-show', () => {
    setTimeout(function(){ 
        splash.close();
        mainWindow.show();
    }, 3000);
})
    
29.03.2017 / 22:45