Skip to content

Instantly share code, notes, and snippets.

@johnnybridges
Last active August 29, 2015 14:25
Show Gist options
  • Select an option

  • Save johnnybridges/d90fc4109b22ef79b96c to your computer and use it in GitHub Desktop.

Select an option

Save johnnybridges/d90fc4109b22ef79b96c to your computer and use it in GitHub Desktop.
Electron app basic setup
var app = require('app'); // Module to control application life.
var BrowserWindow = require('browser-window'); // Module to create native browser window.
// Report crashes to our server.
require('crash-reporter').start();
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is GCed.
var mainWindow = null;
// Quit when all windows are closed.
app.on('window-all-closed', function() {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform != 'darwin') {
app.quit();
}
});
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
app.on('ready', function() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1200,
height: 800,
"node-integration": false,
});
// and load the index.html of the app.
mainWindow.loadUrl('https://www.blossom.io/app/');
// Open the devtools.
// mainWindow.openDevTools();
// Emitted when the window is closed.
mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
mainWindow = null;
});
});
{
"name": "App name",
"description": "App description",
"version": "0.0.1",
"author": {
"name": "your name",
"role": "Dev"
},
"main": "main.js",
"devDependencies": {
"electron-prebuilt": "^0.30.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment