Create splash screen in the Electron application

Asked

Viewed 1,721 times

3

I need to create a kind of Splash Screen for an application on the 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 the mainwindow pulls the link from the http://web.whatsapp.com/ then I don’t have access to the page itself. The splashWindow is local.

Is there some kind of second counter on the Electron?

1 answer

5


You must do something like.

First the main screen must 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);
})

Browser other questions tagged

You are not signed in. Login or sign up in order to post.