# CaptureVisionRouter Instantiate

| Name                                         | Description                                                              |
| -------------------------------------------- | ------------------------------------------------------------------------ |
| `static` [createInstance()](#createinstance) | Initializes a new instance of the `CaptureVisionRouter` class.           |
| [dispose()](#dispose)                        | Releases all resources used by the `CaptureVisionRouter` instance.       |
| [disposed](#disposed)                        | Returns whether the `CaptureVisionRouter` instance has been disposed of. |

## createInstance

Initializes a new instance of the `CaptureVisionRouter` class.

**Syntax**

```typescript
createInstance(loadPresetTemplates?: boolean): Promise<CaptureVisionRouter>;
```

**Parameter**

`loadPresetTemplates`(optional): Determines whether to load the default preset templates.

- true (default): Loads the default templates.
- false: Skips loading the default templates.

**Return value**

A promise that resolves with the initialized `CaptureVisionRouter` instance.

**Code snippet**

```javascript
let router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
```

## dispose

Releases all resources used by the `CaptureVisionRouter` instance.

**Syntax**

```typescript
dispose(): Promise<void>;
```

**Parameter**

None.

**Return value**

A promise that resolves when the resources have been successfully released.

**Code snippet**

```javascript
let router = await Dynamsoft.CVR.CaptureVisionRouter.createInstance();
// Use the router to perform a job.
// ...
// Release the resources after the job is finished.
router.dispose();
```

## disposed

Returns whether the `CaptureVisionRouter` instance has been disposed of.

**Syntax**

```typescript
disposed: boolean;
```

**Parameter**

None.

**Return value**

Boolean indicating whether the `CaptureVisionRouter` instance has been disposed of.

**Code snippet**

```javascript
if(router.disposed){
    console.log("The router has been disposed of.");
} else {
    // Use the router to perform a job.
}
```