Initialization Control
The following static methods and properties help to set up the runtime environment for the library.
_bUseFullFeature
Whether to use the full engine. The property needs to be set before loadWasm.
static _bUseFullFeature: boolean
Default value
false
Code Snippet
Dynamsoft.DBR.BarcodeReader._bUseFullFeature = true;
await Dynamsoft.DBR.BarcodeReader.loadWasm();
See also
engineResourcePath
Specifies the path to find the engine(s). The property needs to be set before loadWasm. If not specified, the library will try to find the engine in the same location as the main JavaScript file (dbr.js).
static engineResourcePath: string
Code Snippet
Dynamsoft.DBR.BarcodeReader.engineResourcePath = "https://cdn.jsdelivr.net/npm/dynamsoft-javascript-barcode@8.4.0/dist/";
await Dynamsoft.DBR.BarcodeReader.loadWasm();
loadWasm
Downloads and compiles the engine to get it loaded/ready for a BarcodeReader or BarcodeScanner instance to be created. You can call this API to silently set the operating environment of the library as soon as the page is loaded, avoiding unnecessary waiting time when using the library later.
If this API is not called beforehand, it will be called automatically when creating an instance of BarcodeReader or BarcodeScanner.
static loadWasm(): Promise<void>
Code Snippet
window.addEventListener('DOMContentLoaded', (event) => {
Dynamsoft.DBR.BarcodeReader.loadWasm();
});
isLoaded
Returns whether the engine is loaded/ready.
static isLoaded(): boolean
version
Returns the version of the library including the detailed version numbers of the engine and the main JavaScript code.
Needs to call after loadWasm.
readonly static version: string
Code Snippet
console.log(Dynamsoft.DBR.BarcodeReader.version); // "loading...(JS 8.2.5.20210426)"
await Dynamsoft.DBR.BarcodeReader.loadWasm();
console.log(Dynamsoft.DBR.BarcodeReader.version); // "8.4.0.8960(JS 8.2.5.20210426)"
detectEnvironment
Returns a report on the current running environments.
static detectEnvironment(): Promise<any>
Code Snippet
console.log(Dynamsoft.DBR.BarcodeReader.detectEnvironment());
// {"wasm":true, "worker":true, "getUserMedia":true, "camera":true, "browser":"Chrome", "version":90, "OS":"Windows"}