electron 打包exe后 限制启动一个程序界面

import { app } from 'electron';

let mainWindow;

const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
 
  if (mainWindow) {
    if (mainWindow.isMinimized()) mainWindow.restore()
    mainWindow.focus()
    mainWindow.show()
  }
})
if (shouldQuit) {
  app.quit()
}

 

posted @ 2022-08-03 14:50  风一样的猿  阅读(343)  评论(0)    收藏  举报