Skip to content

Commit 1bb6513

Browse files
update to internal commit 9eac8b36
1 parent 8e9bba5 commit 1bb6513

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

programming/javascript/api-reference/code-parser-module-class.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The `CodeParserModule` class is defined in the namespace `Dynamsoft.DCP`.
1616
| ------------------------------------ | ----------------------------------------------------------- |
1717
| `static` [getVersion()](#getversion) | Returns the version of the `CodeParser` module. |
1818
| `static` [loadSpec()](#loadspec) | Loads the specification for a certain type of code strings. |
19+
| `static` [onSpecLoadProgressChanged()](#onspecloadprogresschanged) | An event that fires during the loading of specification files. |
1920

2021
### getVersion
2122

@@ -50,3 +51,43 @@ loadSpec(specificationName: string | Array<string>, specificationPath?: string):
5051
```javascript
5152
await Dynamsoft.DCP.CodeParserModule.loadSpec("AADHAAR");
5253
```
54+
55+
### onSpecLoadProgressChanged
56+
57+
An event that fires during the loading of specification files.
58+
59+
**Syntax**
60+
61+
```typescript
62+
static onSpecLoadProgressChanged (filePath: string, tag: "starting"| "in progress" | "completed", progress: { loaded: number, total: number }) : void;
63+
```
64+
65+
**Parameter**
66+
67+
`filePath` : The path of the specification files.
68+
69+
`tag`(Optional) : Indicates the ongoing status of the file download ("starting", "in progress", "completed").
70+
71+
`progress` : An object indicating the progress of the download, with `loaded` and `total` bytes.
72+
73+
**Return value**
74+
75+
None.
76+
77+
**Code snippet**
78+
79+
```javascript
80+
Dynamsoft.DCP.CodeParserModule.onSpecLoadProgressChanged = function(filePath, tag, progress) {
81+
console.log(`Status: ${tag} - File: ${filePath}`);
82+
if (tag === "in progress") {
83+
let percent = ((progress.loaded / progress.total) * 100).toFixed(1);
84+
console.log(`Progress: ${percent}%`);
85+
} else if (tag === "completed") {
86+
console.log("specification files loading completed!");
87+
}
88+
};
89+
```
90+
91+
**Remarks**
92+
93+
Introduced in Dynamsoft Barcode Reader Bundle version 11.2.2000 and Dynamsoft Capture Vision Bundle version 3.2.1000.

0 commit comments

Comments
 (0)