depot/web/lukegbcom/lib/ee-qrcode.worker.js
Luke Granger-Brown 828c7ad578 web/lukegbcom: move ee-qrcode.worker to lib directory
...otherwise nextjs complains and fails the build.
2022-05-01 14:38:28 +01:00

15 lines
389 B
JavaScript

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,
}))
})
})
}