main.js 462 B

123456789101112131415161718192021
  1. const { app, BrowserWindow } = require('electron');
  2. const path = require('node:path');
  3. let win;
  4. app.whenReady().then(function () {
  5. win = new BrowserWindow({
  6. webPreferences: {
  7. contextIsolation: true,
  8. preload: path.join(__dirname, 'preload.js')
  9. }
  10. });
  11. win.loadFile('index.html');
  12. win.webContents.on('console-message', (event) => {
  13. console.log(event.message);
  14. });
  15. win.webContents.on('did-finish-load', () => app.quit());
  16. });