Skip to content

Instantly share code, notes, and snippets.

@hajipy
Created April 29, 2017 16:30
Show Gist options
  • Save hajipy/5f86aab7c6d525074e22d38407710665 to your computer and use it in GitHub Desktop.
Save hajipy/5f86aab7c6d525074e22d38407710665 to your computer and use it in GitHub Desktop.
/// <reference path="typings/globals/node/index.d.ts" />
import electron = require("electron");
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
let window;
function createWindow(): void {
window = new BrowserWindow({width: 800, height: 600});
window.loadURL("file://" + __dirname + "/index.html");
window.webContents.openDevTools();
window.on("closed", () => {
window = null;
})
}
app.on("ready", createWindow);
app.on("window-all-closed", () => {
if (process.platform != 'darwin') {
app.quit();
}
});
app.on("activate", () => {
if (window == null) {
createWindow();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment