Skip to content

Instantly share code, notes, and snippets.

@YannMjl
Created January 30, 2019 18:12
Show Gist options
  • Save YannMjl/6d1388a74637fcacaa5810a9ce099d89 to your computer and use it in GitHub Desktop.
Save YannMjl/6d1388a74637fcacaa5810a9ce099d89 to your computer and use it in GitHub Desktop.
const { app, BrowserWindow } = require('electron')
let win;
function createWindow () {
// Create the browser window.
win = new BrowserWindow({
width: 600,
height: 670,
icon: `file://${__dirname}/dist/assets/logo.png`
})
win.loadURL(`file://${__dirname}/dist/index.html`)
// uncomment below to open the DevTools.
// win.webContents.openDevTools()
// Event when the window is closed.
win.on('closed', function () {
win = null
})
}
// Create window on electron intialization
app.on('ready', createWindow)
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS specific close process
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', function () {
// macOS specific close process
if (win === null) {
createWindow()
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment