main.js 455 B

123456789101112131415161718192021222324
  1. const url = require('url').format({
  2. protocol: 'file',
  3. slashes: true,
  4. pathname: require('path').join(__dirname, 'index.html')
  5. });
  6. const { app, BrowserWindow } = require('electron');
  7. let win;
  8. const createWindow = () => {
  9. win = new BrowserWindow({
  10. width: 500,
  11. height: 850
  12. });
  13. win.loadURL(url);
  14. win.on('closed', () => win = null)
  15. }
  16. app.on('ready', createWindow);
  17. app.on('window-all-closed', () => app.quit())