BarcodeDetector:getSupportedFormats() 静态方法
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
备注: 此特性在 Web Worker 中可用。
BarcodeDetector
接口的 getSupportedFormats()
静态方法返回一个 Promise
,它兑现一个包含受支持的条形码格式类型的数组。
语法
js
BarcodeDetector.getSupportedFormats()
参数
无。
返回值
异常
不会抛出任何异常。
示例
以下示例调用 getSupportedFormats()
方法并将结果记录到控制台。
js
// 检查支持的类型
BarcodeDetector.getSupportedFormats().then((supportedFormats) => {
supportedFormats.forEach((format) => console.log(format));
});
规范
Specification |
---|
Accelerated Shape Detection in Images # dom-barcodedetector-getsupportedformats |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
getSupportedFormats() static method |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- No support
- No support
- Experimental. Expect behavior to change in the future.
- See implementation notes.
- User must explicitly enable this feature.
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.