diff --git a/main.js b/main.js index 8039a7b..1fe4bf0 100644 --- a/main.js +++ b/main.js @@ -2,8 +2,38 @@ const { app, BrowserWindow } = require('electron'); const path = require('path'); const url = require('url'); +// init win let win; function createWindow() { - win = new BrowserWindow({ width: 800, height: 600 }); -} \ No newline at end of file + // Create browser window + win = new BrowserWindow({ width: 800, height: 600, icon: }); + + // Load index.html + win.loadURL(url.format({ + pathname: path.join(__dirname, 'index.html'), + protocol: 'file:', + slashes: true + })); + + // Open devtools + win.webContents().openDevTools(); + + win.on('closed', () => { + win = null; + }); +} + +// Run create window function +app.on('ready', createWindow); + +// Quit when all windows are closed +app.on('window-all-closed', () => { + + // Check if user is on a Mac + if (process.platform !== 'darwin') { + app.quit(); + + } + +}); \ No newline at end of file