2021年4月8日星期四

Why electron's window is not hiding?

I'm new to electron, I created a window using BrowerWindow in electron app, and I set show: false in the constructor, But the window still appears when I executes the app. Please help me.

Electron version - ^12.0.2

const {    app,    BrowserWindow,    ipcMain,    Menu  } = require('electron');    const url = require('url');  const path = require('path');    app.whenReady().then(() => {      createMainWindow();      app.on('activate', () => {      if (BrowserWindow.getAllWindows().length === 0) {        createMainWindow();      }    })  });    app.on('window-all-closed', () => {    if (process.platform !== 'darwin') {      app.quit();    }  });    let mainWin;  function createMainWindow() {    mainWin = new BrowserWindow({      width: 800,      height: 600,      frame: false,         show: false,       icon: path.join(__dirname, '../src/assets/icons/png/64x64.png'),      webPreferences: {        nodeIntegration: true,        contextIsolation: false,        enableRemoteModule: true,          preload: path.join(__dirname, 'preload.js')      }    });      mainWin.loadFile(path.join(__dirname, '../renderers/index.html'));    mainWin.maximize();  }
https://stackoverflow.com/questions/67013749/why-electrons-window-is-not-hiding April 09, 2021 at 09:06AM

没有评论:

发表评论