title: is it bad practice to use app.quit() to close all open windows in an electron app?
body: <p>I have an Electron app with NodeJS and Express.  I have the main process code in one file (app.js) and the routes in another file (router.js).  </p>
  
  <p>The main file creates the main window:</p>
  
  <pre><code>mainWindow = new BrowserWindow({width: 1280, height: 800, icon: iconPath});
  </code></pre>
  
  <p>The routes file creates a new window whenever you click on a pdf document link in the application:</p>
  
  <pre><code> router.get('/docs/:module/:type/:file', function(req, res) {
    openPDF(req.params.module,req.params.type,req.params.file);
    res.end();
  });
  
  // open pdf's in a new window
  let newWindow;
  const openPDF = function(module,filetype,filename) {
  
    let file = 'file:///' + __dirname + '/app/docs/' + module + '/' + filetype + '/' + filename;
  
    let newWindow = new BrowserWindow({
      width: 800, 
      height: 600,
      icon: iconPath,
      webPreferences: {
        nodeIntegration: false
      }
    });
  
    newWindow.setMenu(null);
    // newWindow.webContents.openDevTools();
  
    const param = qs.stringify({file: file});
  
    newWindow.loadURL('file://' + __dirname + '/app/pdfjs/web/viewer.html?' + param);
  
    newWindow.on('closed', function() {
      newWindow = null;
    });
  }
  </code></pre>
  
  <p>When I close the main window I want any other open windows to close as well.  I have been having a difficult time trying to implement this (both windows are in the main process so I can't use IPC to the best of my knowledge.)  Then I realized that if I call app.quit() when the main window closes it closes all of the other windows:</p>
  
  <pre><code>// Emitted when the window is closed.
    mainWindow.on('closed', function () {
      // Dereference the window object, usually you would store windows
      // in an array if your app supports multi windows, this is the time
      // when you should delete the corresponding element.
      mainWindow = null
      // quitting the app on main window close will close any other open windows
      app.quit();
    })
  </code></pre>
  
  <p>My question is whether or not this is a bad thing to do.  It does terminate all open windows without any user input, but there is no unsaved work that could be lost since all of the new windows would be pdf's which can not be edited.</p>