Barcode Detection API Polyfill
一个用TypeScript编写的polyfill,通过调用ZXing或Dynamsoft Barcode Reader作为解码引擎,使主流浏览器都能支持Barcode Detection API。支持生成CJS、ESM和UMD格式的库。
之前的周刊介绍了Barcode Detection API,但支持的浏览器有限,基本只有mac和安卓版Chrome支持。我专门用TypeScript写了一个polyfill,如果浏览器不支持这个API,就调用ZXing或者Dynamsoft Barcode Reader作为解码引擎,让主流浏览器都能使用这个API。打包器用的microbundle,可以生成CJS、ESM和UMD格式的库。项目地址:https://github.com/xulihang/barcode-detector-polyfillDemo:https://extraordinary-taiyaki-4769a5.netlify.app/