index.js
function quitIfAlreadyRunning () {
  if (!electron.app.requestSingleInstanceLock()) {
    return electron.app.quit()
  }
  electron.app.on('second-instance', (event, commandLine, workingDirectory) => {
    // Someone tried to run a second instance, we should focus our window.
    if (windows.main) {
      if (windows.main.isMinimized()) windows.main.restore()
      windows.main.focus()
    }
  })
}
function quitIfAlreadyRunning () {
  if (!electron.app.requestSingleInstanceLock()) {
    return electron.app.quit()
  }
  electron.app.on('second-instance', (event, commandLine, workingDirectory) => {
    // Someone tried to run a second instance, we should focus our window.
    if (windows.main) {
      if (windows.main.isMinimized()) windows.main.restore()
      windows.main.focus()
    }
  })
}
function quitIfAlreadyRunning ( ) { if ( ! electron . app . requestSingleInstanceLock ( ) ) { return electron . app . quit ( ) } electron . app . on ( 'second-instance' , ( event , commandLine , workingDirectory ) => { // Someone tried to run a second instance, we should focus our window. if ( windows . main ) { if ( windows . main . isMinimized ( ) ) windows . main . restore ( ) windows . main . focus ( ) } } ) }
It's not possible to run two instances of patchwork as it would create two
ssb-server instances that conflict on the same port. Before opening patchwork,
we check if it's already running and if it is we focus the existing window
rather than opening a new instance.
It s not possible to run two instances of patchwork as it would create two ssb - server instances that conflict on the same port . Before opening patchwork we check if it s already running and if it is we focus the existing window rather than opening a new instance .