Skip to content

Instantly share code, notes, and snippets.

@yogesh-aggarwal
Created May 1, 2020 11:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yogesh-aggarwal/43cc8aca4a41cf3cf290f0dbb6f15586 to your computer and use it in GitHub Desktop.
Save yogesh-aggarwal/43cc8aca4a41cf3cf290f0dbb6f15586 to your computer and use it in GitHub Desktop.
// ElectronJS basic window
import { app, BrowserWindow } from "electron";
let win: BrowserWindow;
function loadWindow() {
win = new BrowserWindow({
width: 1080,
height: 760,
webPreferences: {
nodeIntegration: true,
},
});
win.setMenuBarVisibility(false);
win.loadFile(`dist/electron-app/index.html`);
// Open the DevTools.
// win.webContents.openDevTools();
win.on("closed", () => {
win = null;
});
}
app.on("ready", loadWindow);
app.on("activate", () => {
if (win === null) {
loadWindow();
}
});
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment