Created
July 31, 2020 12:49
-
-
Save fmacedoo/e6390ffbb2bb701b23da07faa3744221 to your computer and use it in GitHub Desktop.
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; | |
const path = require('path'); | |
const isDev = require('electron-is-dev'); | |
let mainWindow; | |
function createWindow() { | |
mainWindow = new BrowserWindow({ width: 900, height: 680 }); | |
mainWindow.loadURL( | |
isDev | |
? 'http://localhost:3000' | |
: `file://${path.join(__dirname, '../build/index.html')}` | |
); | |
mainWindow.on('closed', () => { | |
mainWindow = null; | |
}); | |
} | |
app.on('ready', createWindow); | |
app.on('window-all-closed', () => { | |
if (process.platform !== 'darwin') { | |
app.quit(); | |
} | |
}); | |
app.on('activate', () => { | |
if (mainWindow === null) { | |
createWindow(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment