Skip to content

Instantly share code, notes, and snippets.

@andrewward2001
Created May 7, 2018 12:18
Show Gist options
  • Select an option

  • Save andrewward2001/1b8e2a3aeb28a1ee398d9017cf735dfd to your computer and use it in GitHub Desktop.

Select an option

Save andrewward2001/1b8e2a3aeb28a1ee398d9017cf735dfd to your computer and use it in GitHub Desktop.
sample electron entry point
const {app} = require('electron');
const {BrowserWindow} = require('electron');
const path = require("path");
let mainWindow;
app.on("ready", function () {
mainWindow = new BrowserWindow({width: 500, height: 500, x: 50, y: 50});
mainWindow.loadURL('file://' + path.join(__dirname,'src/index.html'));
mainWindow.setMenu(null);
mainWindow.webContents.openDevTools()
mainWindow.webContents.on('new-window', function(e, url) {
e.preventDefault();
app.shell.openExternal(url);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment