Created
April 1, 2020 05:38
-
-
Save Mativve/2a5834a0eba6c43cfbf29afee24e5e0d to your computer and use it in GitHub Desktop.
It's main file of electron filesystem.
This file contains 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 { app, BrowserWindow } = require('electron'); | |
function createWindow (){ | |
// Create the browser window. | |
const win = new BrowserWindow({ | |
width: 800, | |
height: 600, | |
webPreferences: { | |
nodeIntegration: true | |
} | |
}); | |
// and load the index.html of the app. | |
win.loadFile('index.html') | |
// Open the DevTools. | |
win.webContents.openDevTools() | |
} | |
app.whenReady().then(createWindow); | |
// Quit when all windows are closed. | |
app.on('window-all-closed', () => { | |
if (process.platform !== 'darwin') { | |
app.quit(); | |
} | |
}) | |
app.on('activate', () => { | |
if (BrowserWindow.getAllWindows().length === 0) { | |
createWindow(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment