Commit ab3fb43a authored by Joel Collins's avatar Joel Collins
Browse files

Fix use of deprecated electron functions

parent 03ee6c1c
Loading
Loading
Loading
Loading
+9 −13
Original line number Diff line number Diff line
@@ -2,10 +2,8 @@
/* global __static */

import { app, protocol, BrowserWindow } from "electron";
import {
  createProtocol,
  installVueDevtools
} from "vue-cli-plugin-electron-builder/lib";
import { createProtocol } from "vue-cli-plugin-electron-builder/lib";
import installExtension, { VUEJS_DEVTOOLS } from "electron-devtools-installer";
const contextMenu = require("electron-context-menu");
const { dialog } = require("electron");
const path = require("path");
@@ -62,7 +60,9 @@ function handleDownloadUpdate() {
    detail: "Please wait...",
    browserWindow: {
      webPreferences: {
        nodeIntegration: true
        // Use pluginOptions.nodeIntegration, leave this alone
        // See https://github.com/nklayman/vue-cli-plugin-electron-builder/blob/v2/docs/guide/configuration.md#node-integration for more info
        nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION
      }
    }
  });
@@ -146,7 +146,9 @@ function createWindow() {
    height: 900,
    icon: path.join(__static, "icon.png"),
    webPreferences: {
      nodeIntegration: true,
      // Use pluginOptions.nodeIntegration, leave this alone
      // See https://github.com/nklayman/vue-cli-plugin-electron-builder/blob/v2/docs/guide/configuration.md#node-integration for more info
      nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
      enableRemoteModule: true
    }
  });
@@ -154,7 +156,6 @@ function createWindow() {
  if (process.env.WEBPACK_DEV_SERVER_URL) {
    // Load the url of the dev server if in development mode
    win.loadURL(process.env.WEBPACK_DEV_SERVER_URL);
    if (!process.env.IS_TEST) win.webContents.openDevTools();
  } else {
    createProtocol("app");
    // Load the index.html when not in development
@@ -189,13 +190,8 @@ app.on("activate", () => {
app.on("ready", async () => {
  if (isDevelopment && !process.env.IS_TEST) {
    // Install Vue Devtools
    // Devtools extensions are broken in Electron 6.0.0 and greater
    // See https://github.com/nklayman/vue-cli-plugin-electron-builder/issues/378 for more info
    // Electron will not launch with Devtools extensions installed on Windows 10 with dark mode
    // If you are not using Windows 10 dark mode, you may uncomment these lines
    // In addition, if the linked issue is closed, you can upgrade electron and uncomment these lines
    try {
      await installVueDevtools();
      await installExtension(VUEJS_DEVTOOLS);
    } catch (e) {
      console.error("Vue Devtools failed to install:", e.toString());
    }