File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
foundational-api-samples/hello-world Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -50,18 +50,20 @@ <h1>Hello World (Read an Image)</h1>
5050 for ( let file of files ) {
5151 // Decode selected image with 'ReadBarcodes_SpeedFirst' template.
5252 const result = await cvRouter . capture ( file , "ReadBarcodes_ReadRateFirst" ) ;
53+ const barcodeResultItems = result . decodedBarcodesResult ?. barcodeResultItems ;
5354
5455 if ( files . length > 1 ) {
5556 resultsContainer . innerText += `\n${ file . name } :\n` ;
5657 }
57- for ( let item of result . items ) {
58- if ( item . type !== Dynamsoft . Core . EnumCapturedResultItemType . CRIT_BARCODE ) {
59- continue ;
60- }
58+ if ( ! barcodeResultItems ?. length ) {
59+ resultsContainer . innerText += "No barcode found\n" ;
60+ continue ;
61+ }
62+
63+ for ( let item of barcodeResultItems ) {
6164 resultsContainer . innerText += item . text + "\n" ;
6265 console . log ( item . text ) ;
6366 }
64- if ( ! result . items . length ) resultsContainer . innerText += "No barcode found\n" ;
6567 }
6668 } catch ( ex ) {
6769 let errMsg = ex . message || ex ;
You can’t perform that action at this time.
0 commit comments