Advertisement
TermSpar

Electron Template

Dec 1st, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const {app, BrowserWindow} = require('electron');
  2. const path = require('path');
  3. const url = require('url');
  4.  
  5. let win;
  6.  
  7. function createWindow(){
  8.   win = new BrowserWindow({width:1300, height:900});
  9.  
  10.   // Load window:
  11.   win.loadURL(url.format({
  12.     pathname: path.join(__dirname, 'index.html'),
  13.     protocol: 'file',
  14.     slashes: true
  15.   }));
  16.  
  17.  
  18.   win.on('closed', () =>{
  19.     win = null;
  20.   });
  21. }
  22.  
  23. // Run the window
  24. app.on('ready', createWindow);
  25.  
  26. // Quit when all windows are closed
  27. app.on('window-all-closed', () => {
  28.   if(process.platform !== 'darwin'){
  29.     app.quit();
  30.   }
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement