Skip to content

Instantly share code, notes, and snippets.

@Mativve
Created April 1, 2020 05:38
Show Gist options
  • Save Mativve/2a5834a0eba6c43cfbf29afee24e5e0d to your computer and use it in GitHub Desktop.
Save Mativve/2a5834a0eba6c43cfbf29afee24e5e0d to your computer and use it in GitHub Desktop.
It's main file of electron filesystem.
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