BarcodeDetector: getSupportedFormats() 靜態方法
注意:此功能在 Web Workers 中可用。
BarcodeDetector 介面的 getSupportedFormats() 靜態方法返回一個 Promise,該 Promise 會以支援的條形碼格式型別的 Array 來 fulfill。
語法
js
BarcodeDetector.getSupportedFormats()
引數
無。
返回值
一個 Promise,它會以 支援的條形碼格式型別 的 Array 來 fulfill。
異常
不會丟擲任何異常。
示例
以下示例呼叫了 getSupportFormat() 靜態方法,並將結果記錄到控制檯。
js
// check supported types
BarcodeDetector.getSupportedFormats().then((supportedFormats) => {
supportedFormats.forEach((format) => console.log(format));
});
規範
| 規範 |
|---|
| 影像中的加速形狀檢測 # dom-barcodedetector-getsupportedformats |
瀏覽器相容性
載入中…