Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

186
Visualizações
Electron Device Access "serial-port-added" / 'serial-port-removed' not firing

I'm running Electron ^18.0.1. I'm trying to get the events to "serial-port-added" / "serial-port-removed". From what I understand from the documentation the events should fire off when devices are connected/disconnect while the "select-serial-port" event has been fired but before the device selection callback has been returned.

My question: I haven't been able to figure out how to get the events to fire off. I'm not sure If have missunderstood the documentation/doing somthing wrong or if it's a bug?

 mainWindow.webContents.session.on('select-serial-port', (event, portList, webContents, callback) => {
    event.preventDefault()
    if (portList && portList.length > 0) {

      // Tried many, many things before running the callback.

      callback(portList[0].portId)
    } else {
      callback('') //Could not find any matching devices
    }
  })

  mainWindow.webContents.session.on('serial-port-added', (event, port) => { // <-- Event not firing?
    console.log('serial-port-added FIRED WITH', port)
  })

  mainWindow.webContents.session.on('serial-port-removed', (event, port) => { // <-- Event not firing?
    console.log('serial-port-removed FIRED WITH', port)

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda