|
|
@ -395,7 +395,7 @@ function createScanner() {
|
|
|
|
y: e.data.size.y
|
|
|
|
y: e.data.size.y
|
|
|
|
}, new Uint8Array(e.data.imageData));
|
|
|
|
}, new Uint8Array(e.data.imageData));
|
|
|
|
scanner.init(config, ready, imageWrapper);
|
|
|
|
scanner.init(config, ready, imageWrapper);
|
|
|
|
scanner.onProcessed(onProcessed);
|
|
|
|
scanner.subscribe("processed", onProcessed);
|
|
|
|
} else if (e.data.cmd === 'process') {
|
|
|
|
} else if (e.data.cmd === 'process') {
|
|
|
|
imageWrapper.data = new Uint8Array(e.data.imageData);
|
|
|
|
imageWrapper.data = new Uint8Array(e.data.imageData);
|
|
|
|
scanner.start();
|
|
|
|
scanner.start();
|
|
|
@ -504,18 +504,6 @@ function createScanner() {
|
|
|
|
unsubscribe(eventName, callback) {
|
|
|
|
unsubscribe(eventName, callback) {
|
|
|
|
_events.unsubscribe(eventName, callback);
|
|
|
|
_events.unsubscribe(eventName, callback);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onDetected: function(callback) {
|
|
|
|
|
|
|
|
_events.subscribe("detected", callback);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
offDetected: function(callback) {
|
|
|
|
|
|
|
|
_events.unsubscribe("detected", callback);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onProcessed: function(callback) {
|
|
|
|
|
|
|
|
_events.subscribe("processed", callback);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
offProcessed: function(callback) {
|
|
|
|
|
|
|
|
_events.unsubscribe("processed", callback);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
registerResultCollector: function(resultCollector) {
|
|
|
|
registerResultCollector: function(resultCollector) {
|
|
|
|
if (resultCollector && typeof resultCollector.addResult === 'function') {
|
|
|
|
if (resultCollector && typeof resultCollector.addResult === 'function') {
|
|
|
|
_resultCollector = resultCollector;
|
|
|
|
_resultCollector = resultCollector;
|
|
|
|