I have a JS module which has some functions for controlling Bluetooth. It includes an array isConnected which holds the connected device. I import it like
isConnected