title: How to add a delay for splash screen in electron
body: <p>I want the splash screen to stay on the screen for 3 seconds but electron loads the application way faster than that and so it stays on for barely a split second.</p>
  <p>I'm using Angular to make the SPA.</p>
  <p>This is the electron function for the splashscreen and the main window</p>
  <pre class="lang-js prettyprint-override"><code>app.on(&quot;ready&quot;, () =&gt; {
    // create main browser window
    mainWindow = new BrowserWindow({
      titleBarStyle: &quot;hidden&quot;,
      width: 1920,
      height: 1080,
      show: false, // don't show the main window
    });
    // create a new `splash`-Window
    splash = new BrowserWindow({
      width: 800,
      height: 450,
      transparent: true,
      frame: false,
      alwaysOnTop: true,
    });
    splash.loadURL(`file://${__dirname}/splash.html`);
    mainWindow.loadURL(`file://${__dirname}/dist/MedalFrontEnd/index.html`);
  
    // if main window is ready to show, then destroy the splash window and show up the main window
    function showFunc() {
      mainWindow.once(&quot;ready-to-show&quot;, () =&gt; {
        splash.destroy();
        mainWindow.show();
      });
    }
  
    showFunc();
  });
  </code></pre>