BluetoothUUID: phương thức tĩnh canonicalUUID()

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

Phương thức tĩnh canonicalUUID() của giao diện BluetoothUUID trả về UUID 128 bit khi truyền vào bí danh UUID 16 bit hoặc 32 bit.

Cú pháp

js
BluetoothUUID.canonicalUUID(alias)

Tham số

alias

Một chuỗi chứa bí danh UUID 16 bit hoặc 32 bit.

Giá trị trả về

Một UUID 128 bit.

Ví dụ

Trong ví dụ sau, UUID được biểu diễn bằng bí danh 0x110A được trả về và in ra console.

js
let result = BluetoothUUID.canonicalUUID("0x110A");
console.log(result); // "0000110a-0000-1000-8000-00805f9b34fb"

Thông số kỹ thuật

Specification
Web Bluetooth
# dom-bluetoothuuid-canonicaluuid

Tương thích trình duyệt