xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

Barcode Detection API All In One

Barcode Detection API All In One

条形码 / 一维条形码 / 二维条形码(二维码)

https://caniuse.com/?search=Barcode

https://developer.mozilla.org/en-US/docs/Web/API/Barcode_Detection_API

https://developer.mozilla.org/en-US/docs/Web/API/BarcodeDetector/getSupportedFormats

demo

function testBarcodeDetector() {
  // Feature detection.
  if (!('BarcodeDetector' in window)) {
    return false;
  } else {
    // Check supported barcode formats.
    BarcodeDetector.getSupportedFormats()
    .then((formats) => {
      console.log('formats =', formats, typeof formats)
      for (const [i, format] of formats.entries()) {
        console.log(`BarcodeDetector SupportedFormat ${i} = ${format}`);
      }
    });
    return true;
  }
}
testBarcodeDetector();

// true
// formats = (11) ['aztec', 'code_128', 'code_39', 'code_93', 'data_matrix', 'ean_13', 'ean_8', 'itf', 'pdf417', 'qr_code', 'upc_e'] 

https://cdn.xgqfrms.xyz/geolocation-api/index.html

Shape Detection API

https://web.dev/shape-detection/

https://wicg.github.io/shape-detection-api/

refs

https://web.dev/mishipay/



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2022-04-22 11:56  xgqfrms  阅读(137)  评论(1编辑  收藏  举报