Created
March 30, 2018 10:52
-
-
Save easychen/3e17b0fafb5e2d783b14fdb8406490bc to your computer and use it in GitHub Desktop.
Electron Main.js demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const electron = require('electron'); | |
const {app} = electron; | |
const {BrowserWindow} = electron; | |
let win; | |
function createWindow() { | |
win = new BrowserWindow({width: 600, height: 1080}); | |
win.loadURL(`file://${__dirname}/index.html`); | |
win.on('closed', () => { | |
win = null; | |
}); | |
} | |
app.on('ready', createWindow); | |
app.on('window-all-closed', () => { | |
if (process.platform !== 'darwin') { | |
app.quit(); | |
} | |
}); | |
app.on('activate', () => { | |
if (win === null) { | |
createWindow(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment