web/lukegbcom: move ee-qrcode.worker to lib directory

...otherwise nextjs complains and fails the build.
This commit is contained in:
Luke Granger-Brown 2022-05-01 14:38:28 +01:00
parent 3d92896314
commit 828c7ad578
3 changed files with 16 additions and 14 deletions

View file

@ -0,0 +1,15 @@
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,
}))
})
})
}

View file

@ -41,7 +41,7 @@ async function startCapture(video, canvas, captureType) {
function scanImage(imageData) {
if (scannerWorker === null) {
scannerWorker = new Worker(new URL('./ee-qrcode.worker.js', import.meta.url))
scannerWorker = new Worker(new URL('../../lib/ee-qrcode.worker.js', import.meta.url))
}
return new Promise(resolve => {

View file

@ -1,13 +0,0 @@
import { scanImageData } from 'zbar.wasm'
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,
}))
})
})