rc-js-util
Version:
A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.
80 lines (37 loc) • 919 B
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [rc-js-util](./rc-js-util.md) > [Once](./rc-js-util.once.md)
## Once() function
Method decorator. The target will be called only once, subsequent calls will return the first return.
**Signature:**
```typescript
export declare function Once<TInstance extends object, TKey extends keyof TInstance>(target: TInstance, key: TKey, descriptor: PropertyDescriptor): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
target
</td><td>
TInstance
</td><td>
</td></tr>
<tr><td>
key
</td><td>
TKey
</td><td>
</td></tr>
<tr><td>
descriptor
</td><td>
PropertyDescriptor
</td><td>
</td></tr>
</tbody></table>
**Returns:**
void