|
|
@ -333,10 +333,10 @@ function(InputStream,
|
|
|
|
|
|
|
|
|
|
|
|
blobURL = generateWorkerBlob();
|
|
|
|
blobURL = generateWorkerBlob();
|
|
|
|
workerThread.worker = new Worker(blobURL);
|
|
|
|
workerThread.worker = new Worker(blobURL);
|
|
|
|
URL.revokeObjectURL(blobURL);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workerThread.worker.onmessage = function(e) {
|
|
|
|
workerThread.worker.onmessage = function(e) {
|
|
|
|
if (e.data.event === 'initialized') {
|
|
|
|
if (e.data.event === 'initialized') {
|
|
|
|
|
|
|
|
URL.revokeObjectURL(blobURL);
|
|
|
|
workerThread.busy = false;
|
|
|
|
workerThread.busy = false;
|
|
|
|
workerThread.imageData = new Uint8Array(e.data.imageData);
|
|
|
|
workerThread.imageData = new Uint8Array(e.data.imageData);
|
|
|
|
console.log("Worker initialized");
|
|
|
|
console.log("Worker initialized");
|
|
|
@ -345,6 +345,8 @@ function(InputStream,
|
|
|
|
workerThread.imageData = new Uint8Array(e.data.imageData);
|
|
|
|
workerThread.imageData = new Uint8Array(e.data.imageData);
|
|
|
|
workerThread.busy = false;
|
|
|
|
workerThread.busy = false;
|
|
|
|
publishResult(e.data.result, workerThread.imageData);
|
|
|
|
publishResult(e.data.result, workerThread.imageData);
|
|
|
|
|
|
|
|
} else if (e.data.event === 'error') {
|
|
|
|
|
|
|
|
console.log("Worker error: " + e.data.message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -359,10 +361,13 @@ function(InputStream,
|
|
|
|
|
|
|
|
|
|
|
|
function workerInterface(factory) {
|
|
|
|
function workerInterface(factory) {
|
|
|
|
if (factory) {
|
|
|
|
if (factory) {
|
|
|
|
|
|
|
|
/* jshint ignore:start */
|
|
|
|
var Quagga = factory();
|
|
|
|
var Quagga = factory();
|
|
|
|
if (!Quagga) {
|
|
|
|
if (!Quagga) {
|
|
|
|
|
|
|
|
self.postMessage({'event': 'error', message: 'Quagga could not be created'});
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* jshint ignore:end */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* jshint ignore:start */
|
|
|
|
/* jshint ignore:start */
|
|
|
|
var imageWrapper;
|
|
|
|
var imageWrapper;
|
|
|
|