<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [worker-tls](./worker-tls.md) &gt; [DynamicWorker](./worker-tls.dynamicworker.md)

## DynamicWorker class

动态Worker

**Signature:**

```typescript
export declare class DynamicWorker<W extends AbstractWorker = Worker> extends WorkerClient<W> 
```
**Extends:** [WorkerClient](./worker-tls.workerclient.md)<!-- -->&lt;W&gt;

## Remarks

动态 Worker 具备以下特点：

- 往 Worker 中添加函数、全局变量 等

- 调用 Worker 中的任意全局函数 或 全局变量

- 像调用本地方法一样调用 Worker 里的方法

- 会自动给实例自身添加快捷命令

- 支持异步、流

- 支持异步和流互相嵌套

## Constructors

<table><thead><tr><th>

Constructor


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[(constructor)()](./worker-tls.dynamicworker._constructor_.md)


</td><td>


</td><td>

Constructs a new instance of the `DynamicWorker` class


</td></tr>
<tr><td>

[(constructor)(worker, name)](./worker-tls.dynamicworker._constructor__1.md)


</td><td>


</td><td>

Constructs a new instance of the `DynamicWorker` class


</td></tr>
<tr><td>

[(constructor)(url, workerOptions)](./worker-tls.dynamicworker._constructor__2.md)


</td><td>


</td><td>

Constructs a new instance of the `DynamicWorker` class


</td></tr>
<tr><td>

[(constructor)(code, workerOptions)](./worker-tls.dynamicworker._constructor__3.md)


</td><td>


</td><td>

Constructs a new instance of the `DynamicWorker` class


</td></tr>
<tr><td>

[(constructor)(codeOrUrlOrWorker, workerOptionsOrName)](./worker-tls.dynamicworker._constructor__4.md)


</td><td>


</td><td>

Constructs a new instance of the `DynamicWorker` class


</td></tr>
</tbody></table>

## Properties

<table><thead><tr><th>

Property


</th><th>

Modifiers


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[executingCount](./worker-tls.dynamicworker.executingcount.md)


</td><td>

`readonly`


</td><td>

number


</td><td>

正在执行中的任务数


</td></tr>
<tr><td>

[worker](./worker-tls.dynamicworker.worker.md)


</td><td>


</td><td>

[DWorker](./worker-tls.dworker.md)<!-- -->&lt;W&gt;


</td><td>

Worker 的实例


</td></tr>
</tbody></table>

## Methods

<table><thead><tr><th>

Method


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[removeCMD(name)](./worker-tls.dynamicworker.removecmd.md)


</td><td>


</td><td>

移除命令


</td></tr>
<tr><td>

[setCMD(cmd, name, isProperty)](./worker-tls.dynamicworker.setcmd.md)


</td><td>


</td><td>

设置命令


</td></tr>
</tbody></table>
