The availabilitychanged
event fires when the Bluetooth system as a whole becomes available or unavailable to the User Agent.
Use the event name in methods like addEventListener()
, or set an event handler property.
addEventListener("availabilitychanged", (event) => { })
onavailabilitychanged = (event) => { }
To be informed when Bluetooth availability changes, you can add a handler to your Bluetooth
instance using addEventListener()
, like this:
Bluetooth.addEventListener("availabilitychanged", (event) => {
const availability = event.value;
});
Alternatively, you can use the Bluetooth.onavailabilitychanged
event handler property to establish a handler for the availabilitychanged
event:
Bluetooth.onavailabilitychanged = (event) => {
const availability = event.value;
};