首页 文章

是否可以在浏览器刷新时保持蓝牙LE连接

提问于
浏览
0

是否可以在浏览器刷新时保持蓝牙LE连接?或者至少最小化配对时间?

1 回答

  • 1

    最终navigator.permissions.query会支持这个 . 示例代码来自Web Bluetooth Specification

    navigator.permissions.query({
      name: "bluetooth",
      deviceId: sessionStorage.lastDevice,
    }).then(result => {
      if (result.devices.length == 1) {
        return result.devices[0];
      } else {
        throw new DOMException("Lost permission", "NotFoundError");
      }
    }).then(...);
    

    但是,no browser currently implements this .

    截至Q3 2017,铬实施正在积极研究Web蓝牙,但没有这个功能 .

相关问题