function createWindow()

in packages/electron/src/electron.ts [140:212]


function createWindow() {
  mainWindow = new BrowserWindow({
    webPreferences: {
      contextIsolation: true,
      preload: path.join(__dirname, "preload.js"),
      nodeIntegration: false,
      enableRemoteModule: true,
    },
    icon: path.join(__dirname, "..", "build", "icon.ico"),
  });

  mainWindow.maximize();
  if (isDev) {
    mainWindow.loadURL("http://localhost:3000");
    mainWindow.webContents.openDevTools();
  } else {
    mainWindow.loadURL(
      url.format({
        pathname: path.join(__dirname, "../react_build/index.html"),
        protocol: "file",
        slashes: true,
      })
    );
  }

  mainWindow.on("closed", () => {
    mainWindow = undefined;
  });

  connection.registerListeners(mainWindow);
  telemetryConnection.registerListeners(mainWindow);

  // Create updater yml
  // @ts-ignore
  autoUpdater.clientPromise = new Promise((resolve) => {
    resolve(
      new LocalProvider(
        upgradeConfig.s3Url,
        // @ts-ignore
        autoUpdater.createProviderRuntimeOptions()
      )
    );
  });

  autoUpdater.on("error", (err) => {
    log.error(err);
  });

  autoUpdater.on('update-available', (info) => {
    latestVersion = info.version;
    outdatedVersionFlag = true;
  })

  autoUpdater.on("update-downloaded", () => {
    dialog
      .showMessageBox(mainWindow!, {
        type: "info",
        buttons: ["Restart", "Later"],
        title: "Application Update",
        message:
          "A new version has been downloaded. Restart the application to apply the updates. You may need to re-assess your solutions after the upgrade.",
      })
      .then((resp) => {
        if (resp.response === 0) {
          connection.closeConnection();
          telemetryConnection.closeConnection();
          autoUpdater.quitAndInstall();
        }
      });
  });

  autoUpdater.checkForUpdates();
}