mirror of
https://github.com/serratus/quaggaJS.git
synced 2026-08-12 21:21:42 +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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user