'Electron JS Get List of connected bluetooth devices

I am new to Electron JS. I'm trying to get a list of currently connected Bluetooth devices. The code that I have tries to pair a new device. That's not what I want but I'm guessing it's an easy fix.

This is what I have so far:

mainWindow.webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
        event.preventDefault()
        if (deviceList && deviceList.length > 0) {
          callback(deviceList[0].deviceId)
        } 
      })

Thanks for any help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source