depot/web/lukegbcom/lib/ee-qrcode.worker.js

16 lines
389 B
JavaScript
Raw Normal View History

import { scanImageData } from 'zbar.wasm'
if (typeof importScripts === "function") {
self.addEventListener('message', async e => {
const symbols = await scanImageData(e.data.imageData)
self.postMessage({
response: symbols.map((sym, n) => ({
index: n,
typeName: sym.typeName,
value: sym.decode(),
points: sym.points,
}))
})
})
}