mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-13 05:31:37 +08:00
fix: publish detected event for multiple
This commit is contained in:
+7
-1
@@ -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) {
|
function publishResult(result, imageData) {
|
||||||
if (result && _onUIThread) {
|
if (result && _onUIThread) {
|
||||||
transformResult(result);
|
transformResult(result);
|
||||||
@@ -227,7 +233,7 @@ function publishResult(result, imageData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Events.publish("processed", result);
|
Events.publish("processed", result);
|
||||||
if (result && result.codeResult) {
|
if (hasCodeResult(result)) {
|
||||||
Events.publish("detected", result);
|
Events.publish("detected", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user