注意:这是2.x的文档

const {app} = require('electron')
let myWindow = null

const shouldQuit = app.makeSingleInstance((commandLine, workingDirectory) => {
  // Someone tried to run a second instance, we should focus our window.
  if (myWindow) {
    if (myWindow.isMinimized()) myWindow.restore()
    myWindow.focus()
    myWindow.show()
  }
})

if (shouldQuit) {
  app.quit()
}

// Create myWindow, load the rest of the app, etc...
app.on('ready', () => {
})

相关文章:

  • 2021-07-24
  • 2022-12-23
  • 2021-09-30
  • 2021-06-27
  • 2021-10-18
  • 2022-01-19
  • 2022-01-08
  • 2022-12-23
猜你喜欢
  • 2021-07-26
  • 2021-07-27
  • 2021-12-04
  • 2022-12-23
  • 2022-12-23
  • 2021-08-04
  • 2022-12-23
相关资源
相似解决方案