BarcodeDetector: phương thức tĩnh getSupportedFormats()
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Phương thức tĩnh getSupportedFormats() của giao diện BarcodeDetector trả về một Promise được hoàn thành với một Array các loại định dạng mã vạch được hỗ trợ.
Cú pháp
js
BarcodeDetector.getSupportedFormats()
Tham số
Không có.
Giá trị trả về
Một Promise được hoàn thành với một Array các loại định dạng mã vạch được hỗ trợ.
Ngoại lệ
Không có ngoại lệ nào được ném ra.
Ví dụ
Ví dụ sau gọi phương thức tĩnh getSupportFormat() và ghi kết quả ra bảng điều khiển.
js
// check supported types
BarcodeDetector.getSupportedFormats().then((supportedFormats) => {
supportedFormats.forEach((format) => console.log(format));
});
Thông số kỹ thuật
| Specification |
|---|
| Accelerated Shape Detection in Images> # dom-barcodedetector-getsupportedformats> |