Skip to content

Commit 4efebaf

Browse files
update to internal commit e2bcff65
1 parent c4ed934 commit 4efebaf

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
push:
99
branches:
1010
- main
11-
#- preview
11+
- preview
1212

1313
# Allows you to run this workflow manually from the Actions tab
1414
workflow_dispatch:

programming/javascript/user-guide/index.md

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -504,23 +504,15 @@ await cvRouter.startCapturing("ReadSingleBarcode");
504504
Please be aware that it is necessary to update the `CapturedResultReceiver` object to obtain the original image. For instance:
505505
506506
```javascript
507-
const EnumCRIT = Dynamsoft.Core.EnumCapturedResultItemType; // Enum for captured result item types.
508-
// Create a result receiver to handle the results.
509-
cvRouter.addResultReceiver({
510-
// This function is called when any capture result is received.
511-
onCapturedResultReceived: (result) => {
512-
//Check for barcode results
513-
let barcodeResultItems = result.items.filter((item) => item.type === EnumCRIT.CRIT_BARCODE);
514-
if (barcodeResultItems.length > 0) {
515-
let image = result.items.filter((item) => item.type === EnumCRIT.CRIT_ORIGINAL_IMAGE)[0]?.imageData; // Retrieve the original image.
516-
if (image) document.body.appendChild(image.toCanvas()); // Append the image to DOM.
517-
for (let item of barcodeResultItems) {
518-
// Print each barcode result to the console.
519-
console.log(`Barcode: ${item.text}, Format: ${item.formatString}`);
520-
}
521-
}
522-
},
523-
});
507+
const EnumCRIT = Dynamsoft.Core.EnumCapturedResultItemType;
508+
resultReceiver.onDecodedBarcodesReceived = (result) => {
509+
if (result.barcodeResultItems?.length) {
510+
// Use a filter to get the image on which barcodes are found.
511+
let image = result.items.filter(
512+
item => item.type === EnumCRIT.CRIT_ORIGINAL_IMAGE
513+
)[0].imageData;
514+
}
515+
};
524516
```
525517
526518
#### 1.3. Change reading frequency to save power

0 commit comments

Comments
 (0)