fix: publish detected event for multiple

This commit is contained in:
dgreif
2016-02-08 21:55:40 -06:00
parent 74c4f04a07
commit 9a9b8de4bc
+7 -1
View File
@@ -220,6 +220,12 @@ function addResult (result, imageData) {
}
}
function hasCodeResult (result) {
return result && result.barcodes ?
result.barcodes.some(barcode => barcode.codeResult) :
result.codeResult;
}
function publishResult(result, imageData) {
if (result && _onUIThread) {
transformResult(result);
@@ -227,7 +233,7 @@ function publishResult(result, imageData) {
}
Events.publish("processed", result);
if (result && result.codeResult) {
if (hasCodeResult(result)) {
Events.publish("detected", result);
}
}