HTMLBluetoothElement
WebComponentHTMLBluetoothElement小于 1 分钟
HTMLBluetoothElement 是蓝牙相关的 WebComponent;
 继承与 HTMLElement;
<dweb-bluetooth></dweb-bluetooth>
属性
plugin
属性值是 BluetoothPlugin对象;
方法
打开蓝牙设备;
关闭蓝牙设备
HTMLBluetoothElement.requestAndConnectDevice()
查询和连接蓝牙设备;
事件
支持任意事件,无预定义事件;
示例
<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>
平台兼容性
| 属性/方法/事件 | Android | IOS | Desktop-Dev | Desktop | 
|---|---|---|---|---|
| plugin | ✅ | ✅ | ✅ | X | 
| open | ✅ | ✅ | ✅ | X | 
| close | ✅ | ✅ | ✅ | X | 
| requestAndConnectDevice | ✅ | ✅ | ✅ | X | 
相关链接
 Powered by  Waline  v2.15.7