Bluetooth: availabilitychanged event
The availabilitychanged
event fires when the Bluetooth system as a whole becomes available or unavailable to the User Agent.
Syntax
Use the event name in methods like addEventListener()
, or set an event handler property.
addEventListener("availabilitychanged", (event) => { })
onavailabilitychanged = (event) => { }
Event type
Examples
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;
};
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
availabilitychanged_event |
56 |
79 |
No |
No |
43 |
No |
No |
No |
No |
No |
No |
No |
See also