HTMLBluetoothElement
WebComponentHTMLBluetoothElementLess than 1 minute
HTMLBluetoothElement is a WebComponent related to bluetooth.
Inherits from HTMLElement;
<dweb-bluetooth></dweb-bluetooth>
Properties
plugin
The property value is the BluetoothPlugin object;
Methods
Opens the bluetooth device;
Closes the bluetooth device;
HTMLBluetoothElement.requestAndConnectDevice()
Queries and connects bluetooth devices;
Events
Supports any events, no predefined events;
Example
<body>
<dweb-bluetooth></dweb-bluetooth>
<button>open</button>
<script type="module">
import "@plaoc/plugins"
const bluetooth = document.querySelector("dweb-bluetooth")!
const btn = document.querySelector('button');
btn.addEventListener('click', async () => {
const res = await bluetooth.open();
})
</script>
</body>
Platform Compatibility
Properties/Methods/Events | Android | iOS | Desktop-Dev | Desktop |
---|---|---|---|---|
plugin | ✅ | ✅ | ✅ | X |
open | ✅ | ✅ | ✅ | X |
close | ✅ | ✅ | ✅ | X |
requestAndConnectDevice | ✅ | ✅ | ✅ | X |
Related Links
Powered by Waline v2.15.7