BarcodeDetector: getSupportedFormats() static method
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{securecontext_header}}{{APIRef("Barcode Detector API")}}{{AvailableInWorkers}}{{SeeCompatTable}}
The **getSupportedFormats()** static method of the {{domxref("BarcodeDetector")}} interface returns a {{jsxref('Promise')}} which fulfills with an {{jsxref('Array')}} of supported barcode format types.
Syntax
js-nolint
BarcodeDetector.getSupportedFormats()Parameters
None.
Return value
A {{jsxref('Promise')}} which fulfills with an {{jsxref('Array')}} of supported barcode format types.
Exceptions
No exceptions are thrown.
Examples
The following example calls the getSupportedFormats() static method and logs the results to the console.
js
// check supported types
BarcodeDetector.getSupportedFormats().then((supportedFormats) => {
supportedFormats.forEach((format) => console.log(format));
});Specifications
{{Specifications}}
Browser compatibility
{{Compat}}