plugin-tls
Version:
plugin-tls 是插件系统相应的工具,可快速地让任何模块具备插件机制
77 lines (36 loc) • 1.04 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [plugin-tls](./plugin-tls.md) > [defineMixin](./plugin-tls.definemixin.md)
## defineMixin() function
定义混合的类型便利函数
**Signature:**
```typescript
export declare function defineMixin<T, M>(target: T, mixin: M & ThisType<T & M>): M & ThisType<T & M>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
target
</td><td>
T
</td><td>
混合的目标,用作 this 的类型
</td></tr>
<tr><td>
mixin
</td><td>
M & ThisType<T & M>
</td><td>
混合对象,会自动更改其this的类型
</td></tr>
</tbody></table>
**Returns:**
M & ThisType<T & M>
返回注入了 this 类型的 mixin 对象本身
## Remarks
它会更改 mixin 中方法的this指向为 target & mixin,不会真的执行混合操作