title: Quitting an electron app after setInterval() from external script file
body: <p>Edited for more clarity.</p>
  <p>I am trying to make a splash screen applet - to start learning nodejs and electron.</p>
  <p>I want to create an applet that launches, shows some messages every 10 seconds, and then quits.</p>
  <p>I'm basing it off the Discord app and Teams where they have pop up loading screens that have a progress bar, and once completed load the full application.</p>
  <p>I want to know how to do it before the &quot;load full app&quot; portion kicks in and how to close the splash screen completely.</p>
  <p>Currently I have an <code>index.js</code>, <code>index.html</code>, and a <code>main.js</code>.</p>
  <p><code>index.js</code> is the electron browser window. <code>index.html</code> is the main rendered page, and the <code>main.js</code> is the timer to switch the <code>innerHTML</code> based on the time from:</p>
  <pre class="lang-js prettyprint-override"><code>// main.js
  var startTime       = 0,
      totalTime       = 10,
      timeBuffer      = 2,
      totalPercent    = 0,
      timeCounter     = setInterval( progress, 1000 );
  
  function progress() {
      if( (startTime += 1) &gt;= (totalTime + timeBuffer + 1) ) {
          // quit app (1)
      } else {
          // show messages here
      }
  }
  </code></pre>
  <p>At point <code>(1)</code> in the code, I've tried adding in <code>app.close();</code> but that fails since I haven't added in <code>app</code>. I tried adding it in but that doesn't work either.</p>
  <p>I tried adding in:</p>
  <pre class="lang-js prettyprint-override"><code>// main.js
  const { ipcRenderer } = require('electron');
  ipcRenderer.send('close-me');
  
  //index.js
  ipcMain.on( 'close-me', (evt, arg) =&gt; {
      app.quit();
  });
  </code></pre>
  <p>But this didn't work either. I'm still trying to understand the relationship between <code>index.js</code> and the other scripts you might write for the app - but thought quitting the app entirely would be easy.</p>