How to use the vue-cli-plugin-electron-builder/lib.createProtocol function in vue-cli-plugin-electron-builder

To help you get started, we’ve selected a few vue-cli-plugin-electron-builder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cutls / TheDesk / src / main / Application.ts View on Github external
private async onReady() {
        if (isDevelopment && !process.env.IS_TEST) {
            // Install Vue Devtools
            try {
                await installVueDevtools()
            } catch (e) {
                console.error('Vue Devtools failed to install:', e.toString())
            }
        }
        if (!process.env.WEBPACK_DEV_SERVER_URL) createProtocol('app')

        Timeline.ready()
        Streaming.ready()
        Auth.ready()

        ipcMain.on('dark-theme', (e: Event) => e.returnValue = this.isDarkMode)

        ipcMain.on('is-startup', (e: Event) => {
            // 初回起動かどうかをここで判断させる。timeline.dbかaccount.dbがあれば初回起動じゃない扱いでもいいか?
            e.returnValue = true
        })

        Window.Main()
    }
github d2-projects / folder-explorer / src / background.js View on Github external
width: 800,
    height: 500,
    minWidth: 800,
    minHeight: 500,
    webPreferences: {
      nodeIntegration: true
    }
  })

  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
    win.loadURL('app://./index.html')
  }

  win.on('closed', () => {
    win = null
  })
}
github rotki / rotki / frontend / app / src / background.ts View on Github external
webPreferences: {
      nodeIntegration: false,
      sandbox: true,
      enableRemoteModule: false,
      contextIsolation: true,
      preload: path.join(__dirname, 'preload.js')
    }
  });

  if (process.env.WEBPACK_DEV_SERVER_URL) {
    pyHandler.setCorsURL(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
    pyHandler.setCorsURL('app://*');
    win.loadURL('app://./index.html');
  }

  const menuTemplate: MenuItemConstructorOptions[] = defaultMenuTemplate as MenuItemConstructorOptions[];
  Menu.setApplicationMenu(Menu.buildFromTemplate(menuTemplate));

  // Register and deregister listeners to window events (resize, move, close) so that window state is saved
  mainWindowState.manage(win);

  win.on('closed', async () => {
    win = null;
  });

  pyHandler.createPyProc(win);
github Arattian / DynamoDb-GUI-Client / src / background.ts View on Github external
width: 1400,
    height: 900,
    center: true,
    show: false,
  });
  win.once('ready-to-show', () => {
    win.show();
  });
  if (isDevelopment) {
    // Load the url of the dev server if in development mode
    win.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string);
    if (!process.env.IS_TEST) {
      win.webContents.openDevTools();
    }
  } else {
    createProtocol('app');
    // Load the index.html when not in development
    win.loadFile('index.html');
  }

  win.on('closed', () => {
    win = null;
  });
}
github jarbun / downline / src / background.js View on Github external
win = new BrowserWindow({
    width: isDevelopment ? 900 : 650,
    height: 520,
    frame: false,
    show: false,
    webPreferences: {
      nodeIntegration: true
    }
  });

  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
    win.loadURL('app://./index.html');
  }

  win.once('ready-to-show', win.show);

  win.on('close', event => {
    if (!isSaved) {
      event.preventDefault();
      win.webContents.send('save');
    }
  });

  win.on('closed', () => {
    win = null;
  });
github nklayman / vue-cli-plugin-electron-builder / generator / templates / base / src / background.js View on Github external
function createWindow () {
  // Create the browser window.
  win = new BrowserWindow({ width: 800, height: 600 })

  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
    win.loadURL('app://./index.html')
  }

  win.on('closed', () => {
    win = null
  })
}
github getgridea / gridea / src / background.ts View on Github external
titleBarStyle: 'hiddenInset' as ('hidden' | 'default' | 'hiddenInset' | 'customButtonsOnHover' | undefined),
  }

  if (process.platform !== 'darwin') {
    winOption.icon = `${__dirname}/app-icons/gridea.png`
  }
  
  win = new BrowserWindow(winOption)
  win.setTitle('Gridea')

  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 as string)
    if (!process.env.IS_TEST) { win.webContents.openDevTools() }
  } else {
    createProtocol('app')
    // Load the index.html when not in development
    win.loadURL('app://./index.html')
    autoUpdater.checkForUpdatesAndNotify()
  }

  win.on('closed', () => {
    win = null
  })

  const locale: string = app.getLocale() || 'zh-CN'
  const menuLabels = messages[locale] || messages['zh-CN']
  // menu
  const template: any = [
    {
      label: menuLabels.edit,
      submenu: [
github CopyTranslator / CopyTranslator / src / background.ts View on Github external
function createWindow() {
  // Create the browser window.
  focusWin = new BrowserWindow({
    width: 800,
    height: 600,
    // transparent: true,
    frame: false,
  });
  focusWin.setAlwaysOnTop(true);

  if (process.env.WEBPACK_DEV_SERVER_URL) {
    // Load the url of the dev server if in development mode
    focusWin.loadURL(process.env.WEBPACK_DEV_SERVER_URL);
    if (!process.env.IS_TEST) focusWin.webContents.openDevTools();
  } else {
    createProtocol("app");
    // Load the index.html when not in development
    focusWin.loadURL("app://./index.html");
  }

  focusWin.on("closed", () => {
    focusWin = null;
  });
}
github MobileTribe / panda-lab / agent / src / background.ts View on Github external
// Create the browser window.
    win = new BrowserWindow({
        width: 1500, height: 800, webPreferences: {
            nodeIntegration: true,
        }
    });

    app.dock.show();


    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
        win.loadURL('app://./index.html')
    }

    win.on('closed', () => {
        win = null;
        app.dock.hide();
    })
}

vue-cli-plugin-electron-builder

Easily Build Your Vue.js App For Desktop With Electron

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis