@@ -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
5152await 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