worker-tls
Version:
worker-tls 提供了 动态Worker 功能 和 其它一些 Worker 场景下有用的工具集;让开发者可以像调用对象方法一样动态地调用Worker中的方法,也可以随时地往 Worker 中动态地添加函数 等等。
234 lines (105 loc) • 2.95 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [worker-tls](./worker-tls.md) > [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)<!-- --><W>
## 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)<!-- --><W>
</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>