text: const {app, BrowserWindow, ipcMain} = require('electron')
  const Path = require('path')
  
  app.commandLine.appendSwitch('remote-debugging-port', '8472');
  
  function createWindow () {
    const mainWindow = new BrowserWindow({
      width: 800,
      height: 480,
      useContentSize: true,
      webPreferences: {
        preload: Path.join(__dirname, 'preload.js'),
        nodeIntegration: false,
        contextIsolation: true,
      }
    });
  
    if (process.env.NODE_ENV === 'development') {
      const rendererPort = process.argv[2];
      mainWindow.loadURL(`http://localhost:${rendererPort}`);
      
      mainWindow.webContents.on('did-frame-finish-load', () => {
        mainWindow.webContents.once('devtools-opened', () => {
          mainWindow.focus()
        })
        mainWindow.webContents.openDevTools()
      })
    }
    else {
      mainWindow.loadFile(Path.join(app.getAppPath(), 'renderer', 'index.html'));
    }
  }
  
  app.whenReady().then(() => {
    createWindow();
  
    app.on('activate', function () {
      // On macOS it's common to re-create a window in the app when the
      // dock icon is clicked and there are no other windows open.
      if (BrowserWindow.getAllWindows().length === 0) {
        createWindow();
      }
    });
  });
  
  app.on('window-all-closed', function () {
    app.quit()
    // if (process.platform !== 'darwin') app.quit()
  });
  
  ipcMain.on('message', (event, message) => {
    console.log(message);
  })
  