Bluetooth: getDevices() method
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("Bluetooth API")}}{{SeeCompatTable}}{{securecontext_header}}
The **getDevices()** method of the {{DOMxRef("Bluetooth")}} interface returns an array containing the Bluetooth devices that this origin is allowed to access — including those that are out of range and powered off.
Syntax
js-nolint
getDevices()Parameters
None.
Return value
A {{JSxRef("Promise")}} that resolves with an array of {{DOMxRef("BluetoothDevice")}} objects.
Exceptions
SecurityError{{domxref("DOMException")}}- : Thrown if this operation is not permitted in this context due to security concerns, such as being called when access to the current document is blocked by the Permissions Policy directive {{HTTPHeader("Permissions-Policy/bluetooth","bluetooth")}}.
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}