Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

3 changes: 1 addition & 2 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ docHomePage: /capture-vision/docs/web/programming/javascript/

dcvb_introduction: /capture-vision/docs/core/introduction/
dcvb_architecture: /capture-vision/docs/core/architecture/
dcvb_parameter: /capture-vision/docs/core/parameters/
dcvb_parameters: /capture-vision/docs/core/parameters/reference/
dcvb_parameterFile: /capture-vision/docs/core/parameters/file/
dcvb_parameterReference: /capture-vision/docs/core/parameters/reference/
dcvb_enums: /capture-vision/docs/core/enums/
license_activation: /capture-vision/docs/core/license/

Expand Down
2 changes: 1 addition & 1 deletion _data/product_version.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
useGroupedVersion: true

version_info_list:
- value: latest version(2.4.2000)
- value: latest version(2.4.2100)
- value: 2.x
child:
- 2.2.3000
2 changes: 1 addition & 1 deletion _includes/sidelist-programming/programming-js.html
Original file line number Diff line number Diff line change
Expand Up @@ -1464,4 +1464,4 @@
</li> -->
</ul>
</li>
<li lang="javascript"><a href="{{ site.license_activation }}index.html" class="otherLinkColour">License Initialization</a></li>
<li lang="javascript"><a href="{{ site.license_activation }}index.html" class="otherLinkColour">License Initialization</a></li>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li lang="javascript">
<a href="{{ site.dcvb_parameter }}reference/index.html" class="otherLinkColour"
<a href="{{ site.dcvb_parameters }}reference/index.html" class="otherLinkColour"
>Parameter Reference</a
>
<ul>
Expand Down
4 changes: 2 additions & 2 deletions assets/js/dcvWebVersionSearch.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[
{
"version": "2.4.2000",
"version": "2.4.2100",
"matchVersion": {
"javascript": "10.4.2000"
"javascript": "10.4.2001"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ startCapturing(templateName?: string): Promise<void>;

**Parameters**

`templateName`: specifies a "CaptureVisionTemplate" to use. If not specified, "Default" is used. There are two types of CaptureVisionTemplates: the [preset ones](./preset-templates.md) which come with the SDK and the custom ones that get initialized when the user calls [initSettings](./settings.md#initsettings). Please be aware that the [preset CaptureVisionTemplates](./preset-templates.md) will be overwritten should the user calls [initSettings](./settings.md#initsettings) and pass his own settings.
`templateName`: specifies a "CaptureVisionTemplate" to use. If not specified, "Default" is used. There are two types of CaptureVisionTemplates: the [preset ones](./preset-templates.md) which come with the SDK and the custom ones that get initialized when the user calls [initSettings](./settings.md#initsettings). Please be aware that the [preset CaptureVisionTemplates](./preset-templates.md) will be overwritten if the user calls [initSettings](./settings.md#initsettings) and passes customized settings.

**Return Value**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,11 @@ startCapturing(templateName?: string): Promise<void>;

**Parameters**

`templateName`: specifies a "CaptureVisionTemplate" to use. If not specified, "Default" is used.
`templateName`: specifies a "CaptureVisionTemplate" to use. If not specified, the preset template named 'Default' will be used.

There are two types of CaptureVisionTemplates: the [preset ones](./preset-templates.md) which come with the SDK and the custom ones that get initialized when the user calls [initSettings](./settings.md#initsettings).

Please be aware that the [preset CaptureVisionTemplates](./preset-templates.md) will be overwritten should the user calls [initSettings](./settings.md#initsettings) and pass his own settings.
Please be aware that the [preset CaptureVisionTemplates](./preset-templates.md) will be overwritten if the user calls [initSettings](./settings.md#initsettings) and passes customized settings.

**Return Value**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ capture(imageOrFile: Core.DSImageData | string | Blob | HTMLImageElement | HTMLC

`imageOrFile`: specifies the image or file to be processed. It can be the image itself in the form of `DSImageData`, the path of the image/file or the file itself in the form of `blob`, `HTMLImageElement` or `HTMLCanvasElement`.

`templateName`: specifies a "CaptureVisionTemplate" to use. If not specified, "Default" is used. There are two types of CaptureVisionTemplates: the [preset ones](./preset-templates.md) which come with the SDK and the custom ones that get initialized when the user calls [initSettings](./settings.md#initsettings). Please be aware that the [preset CaptureVisionTemplates](./preset-templates.md) will be overwritten should the user calls [initSettings](./settings.md#initsettings) and pass his own settings.
`templateName`: specifies a "CaptureVisionTemplate" to use. If not specified, "Default" is used. There are two types of CaptureVisionTemplates: the [preset ones](./preset-templates.md) which come with the SDK and the custom ones that get initialized when the user calls [initSettings](./settings.md#initsettings). Please be aware that the [preset CaptureVisionTemplates](./preset-templates.md) will be overwritten if the user calls [initSettings](./settings.md#initsettings) and passes customized settings.

**Return value**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ capture(imageOrFile: Blob | HTMLImageElement | HTMLCanvasElement | HTMLVideoElem

There are two types of CaptureVisionTemplates: the [preset ones](./preset-templates.md) which come with the SDK and the custom ones that get initialized when the user calls [initSettings](./settings.md#initsettings).

Please be aware that the [preset CaptureVisionTemplates](./preset-templates.md) will be overwritten should the user calls [initSettings](./settings.md#initsettings) and pass his own settings.
Please be aware that the [preset CaptureVisionTemplates](./preset-templates.md) will be overwritten if the user calls [initSettings](./settings.md#initsettings) and passes customized settings.

**Return value**

Expand Down
241 changes: 241 additions & 0 deletions programming/javascript/api-reference/core/core-module-class-v3.2.30.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
---
layout: default-layout
title: API Reference Index - CoreModule Class in JavaScript
description: This page introduces the API for the CoreModule Class.
keywords: Core, CoreModule, api reference, javascript, js
needAutoGenerateSidebar: true
needGenerateH3Content: true
noTitleIndex: true
---
<!--v3.0.20--Updated on 11/23/2023-->

# CoreModule Class

The CoreModule class defines common functionality in the Core module.

| Name | Description |
| ---------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `static` [detectEnvironment()](#detectenvironment) | Detects and returns information about the current runtime environment. |
| `static` [engineResourcePaths](#engineresourcepaths) | Configures the paths where the .wasm files and other necessary resources for modules are located. |
| `static` [getVersion()](#getversion) | Returns the version of the Core module. |
| `static` [isModuleLoaded()](#ismoduleloaded) | Returns whether the WebAssembly (.wasm) file for the specified module is successfully loaded. |
| `static` [loadWasm()](#loadwasm) | Initiates the loading process for the .wasm file(s) corresponding to the specified module(s). |

<!--
| `static` [onLog](#onlog) | Event triggered whenever a log message is ready to be dispatched. |
| `static` [disableLogging()](#disablelogging) | Disables logging. |
| `static` [enableLogging()](#enablelogging) | Enables logging to print internal logs to the browser console for debugging. | -->

## detectEnvironment

Detects and returns information about the current runtime environment.

```typescript
detectEnvironment(): Promise<any>
```

**Return Value**

A promise that resolves with the detected environment information (e.g., browser type and version, operating system, camera support, etc.).

**Code snippet**

```javascript
await Dynamsoft.Core.CoreModule.detectEnvironment();
// Example return value:
// {"wasm":true,"worker":true,"getUserMedia":true,"camera":true,"browser":"Edge","version":119,"OS":"Windows"}
```

## engineResourcePaths

Configures the paths where the .wasm files and other necessary resources for modules are located. It allows you to either return or set the paths that the system uses to find these resources.

For resources loaded from popular CDNs like jsDelivr or UNPKG, the paths are automatically identified based on the JavaScript files referenced for these modules. Manual specification of these paths is necessary only in the following scenarios:

1. When integrating the SDK within web frameworks such as Angular, React, or Vue.
2. If you opt for a CDN different from the default choices.
3. When you are serving the files on your own.

<!--
> Specifying only the "rootDirectory" configures all paths to align with this directory automatically. However, if you provide both "rootDirectory" and specific paths for individual modules, the specific module paths will override the root directory setting.
/** NOT WORKING AS EXPECTED YET
* Specifies the root directory in which all the modules are located
*/
"rootDirectory"?: string;
/** WILL BE RENAMED TO dlrData LATER
* Specifies the resource path for the dynamsoft-capture-vision-dnn module.
*/
"dcm"?: string;
/** NOT AVAILABLE NOW
* Specifies the resource path for the dynamsoft-capture-vision-dnn module.
*/
"dnn"?: string;
-->
```typescript
static engineResourcePaths: {
/**
* Specifies the resource path for the dynamsoft-capture-vision-std module.
*/
"std"?: string;
/**
* Specifies the resource path for the dynamsoft-image-processing module.
*/
"dip"?: string;
/**
* Specifies the resource path for the dynamsoft-core module.
*/
"core"?: string;
/**
* Specifies the resource path for the dynamsoft-license module.
*/
"license"?: string;
/**
* Specifies the resource path for the dynamsoft-capture-vision-router module.
*/
"cvr"?: string;
/**
* Specifies the resource path for the dynamsoft-utility module.
*/
"utility"?: string;
/**
* Specifies the resource path for the dynamsoft-barcode-reader module.
*/
"dbr"?: string;
/**
* Specifies the resource path for the dynamsoft-label-recognizer module.
*/
"dlr"?: string;
/**
* Specifies the resource path for the dynamsoft-document-normalizer module.
*/
"ddn"?: string;
/**
* Specifies the resource path for the dynamsoft-code-parser module.
*/
"dcp"?: string;
/**
* Specifies the resource path for the dynamsoft-camera-enhancer module.
*/
"dce"?: string;
};
```

**Code snippet**

```javascript
// To specify the paths for multiple modules:
Dynamsoft.Core.CoreModule.engineResourcePaths = {
"std": "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-capture-vision-std@1.0.0/dist/",
"dip": "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-image-processing@2.0.20/dist/",
"core": "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-core@3.0.20/dist/",
"license": "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-license@3.0.20/dist/",
"cvr": "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-capture-vision-router@2.0.20/dist/",
"utility": "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-utility@1.0.20/dist/",
"dbr": "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-barcode-reader@10.0.20/dist/"
"dlr": "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-label-recognizer@3.0.20/dist/",
"ddn": "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-document-normalizer@2.0.20/dist/"
"dcp": "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-code-parser@2.0.20/dist/"
};
// To specify the path for only one module:
Dynamsoft.Core.CoreModule.engineResourcePaths.dbr = "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-barcode-reader@10.0.20/dist/";
```

## getVersion

Returns the version of the Core module.

```typescript
static getVersion(): string;
```

**Return Value**

A string type representing the version.

**Code snippet**

```javascript
const version = Dynamsoft.Core.CoreModule.getVersion();
console.log(version);
```

## isModuleLoaded

Returns whether the WebAssembly (.wasm) file for the specified module is successfully loaded.

```typescript
static isModuleLoaded(moduleName: string): boolean;
```

**Parameters**

`moduleName`: specifies a module.

**Return Value**

Boolean indicating whether the .wasm file for the specified module is loaded.

**Code snippet**

```javascript
if(Dynamsoft.Core.CoreModule.isModuleLoaded("cvr")){
console.log("cvr module is loaded!").
}
```

## loadWasm

Initiates the loading process for the .wasm file(s) corresponding to the specified module(s). If a module relies on other modules, the other modules will be loaded as well.

```typescript
static loadWasm(moduleNames: Array<string> | string): Promise<void>;
```

**Parameters**

`moduleNames`: specifies one or multiple modules. Supported module names are "cvr", "core", "license", "std", "dip", "dbr", "dlr", "ddn".

**Return Value**

A promise that resolves when the resources have been successfully released. It does not provide any value upon resolution.

**Code snippet**

```javascript
await Dynamsoft.Core.CoreModule.loadWasm("cvr");
```

<!--
## onLog

Event triggered whenever a log message is ready to be dispatched.

```typescript
static onLog: (message:string) =>void;
```

**Parameters**

`message`: the log message ready to be dispatched.

**Code snippet**

```javascript
Dynamsoft.Core.CoreModule.onLog = console.log;
```

## disableLogging

Disables logging.

```typescript
static disableLogging(): void;
```

## enableLogging

Enables logging to print internal logs to the browser console for debugging.

```typescript
static enableLogging(): void;
``` -->
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ For resources loaded from popular CDNs like jsDelivr or UNPKG, the paths are aut
-->
```typescript
static engineResourcePaths: {
/**
* Specifies the root directory in which all the modules are located
*/
"rootDirectory"?: string;
/**
* Specifies the resource path for the dynamsoft-capture-vision-std module.
*/
Expand Down Expand Up @@ -123,6 +127,8 @@ static engineResourcePaths: {
**Code snippet**

```javascript
// To specify the path for rootDirectory
Dynamsoft.Core.CoreModule.engineResourcePaths.rootDirectory = "https://cdn.jsdelivr.net/npm/";
// To specify the paths for multiple modules:
Dynamsoft.Core.CoreModule.engineResourcePaths = {
"std": "https://[SPECIFY-THE-ROOT-DIRECTORY]/dynamsoft-capture-vision-std@1.0.0/dist/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ A promise which, upon resolution, yields a string corresponding to the device's
Initializes the license for the application using a license key. This function is overloaded, providing two different usages based on the provided parameters.

```typescript
static initLicense(license: string, options?: {executeNow: boolean}): void | Promise<void>;
static initLicense(license: string, options?: {executeNow: boolean} | boolean): void | Promise<void>;
```

**Parameters**

`license`: The license key to be used for initialization.

`options`: This is an object with a single property executeNow, which is a boolean indicates the function should immediately execute the license initialization or not.
`options`: It can be one of two types, a boolean or an object with a single property, executeNow, which is a boolean. If options is `true` or `{ executeNow: true }`, the license initialization action will be executed immediately.

**Return Value**

Expand Down
2 changes: 1 addition & 1 deletion programming/javascript/release-notes/dcvb.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ noTitleIndex: true

# Release Notes - DynamsoftCaptureVisionBundle

## 2.4.2000 (10/10/2024)
## 2.4.2100 (10/17/2024)

### Highlights

Expand Down
2 changes: 1 addition & 1 deletion programming/javascript/release-notes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ noTitleIndex: true

# Release Notes - Dynamsoft Capture Vision Bundle JavaScript

- [2.4.2000 (10/10/2024)](dcvb.md#242000-10102024)
- [2.4.2100 (10/17/2024)](dcvb.md#242100-10172024)
- [2.2.3000 (07/21/2024)](dcvb.md#223000-07212024)
Loading