web/lukegbcom: move ee-qrcode.worker to lib directory
...otherwise nextjs complains and fails the build.
This commit is contained in:
parent
3d92896314
commit
828c7ad578
3 changed files with 16 additions and 14 deletions
15
web/lukegbcom/lib/ee-qrcode.worker.js
Normal file
15
web/lukegbcom/lib/ee-qrcode.worker.js
Normal 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,
|
||||
}))
|
||||
})
|
||||
})
|
||||
}
|
|
@ -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 => {
|
||||
|
|
|
@ -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,
|
||||
}))
|
||||
})
|
||||
})
|
Loading…
Reference in a new issue