Bluetooth

 

非标准

该特性是非标准的,请尽量不要在生产环境中使用它!

Web Bluetooth API 的Bluetooth接口返回指代BluetoothDevice (en-US)带有指定选项的对象的Promise

接口

interface Bluetooth {
  Promise<BluetoothDevice> requestDevice(RequestDeviceOptions options);
};
Bluetooth implements EventTarget;
Bluetooth implements BluetoothDeviceEventHandlers;
Bluetooth implements CharacteristicEventHandlers;
Bluetooth implements ServiceEventHandlers;

特性

方法

Bluetooth.requestDevice()
返回一个包含指定选项的BluetoothDevice (en-US)对象的Promise

详细说明

Specification Status Comment
Web Bluetooth
Bluetooth
Draft Initial definition.

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 45.0 [1]        
Feature Android Android Webview Firefox Mobile (Gecko) Firefox OS IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support 未实现 未实现           48.0 [2]

[1] 注意事项:仅谷歌浏览器可用

[2] 注意事项:仅安卓6以上可用