Skip to content

Commit 6029fbb

Browse files
committed
Update read-an-image.html
1 parent e31fa73 commit 6029fbb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

hello-world/read-an-image.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ <h1>Hello World (Read an Image)</h1>
4242
// Preload "BarcodeReader" module for reading barcodes. It will save time on the initial decoding by skipping the module loading.
4343
Dynamsoft.Core.CoreModule.loadWasm(["DBR"]);
4444

45-
let pRouter;
4645
const divResultContainer = document.querySelector(
4746
"#div-result-container"
4847
);
48+
49+
const pRouter = Dynamsoft.CVR.CaptureVisionRouter.createInstance();
50+
4951
document.querySelector("input").onchange = async () => {
5052
try{
51-
const router = await (pRouter || pRouter = await Dynamsoft.CVR.CaptureVisionRouter.createInstance());
53+
const router = await pRouter;
5254
// Decode selected image with 'ReadBarcodes_SpeedFirst' template.
5355
const result = await router.capture(
5456
this.files[0],

0 commit comments

Comments
 (0)