@empathyco/x-components
Version:
Empathy X Components
89 lines (41 loc) • 1.49 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [debounce](./x-components.debounce.md)
## debounce() function
Creates a debounced [Wire](./x-components.wire.md)<!-- -->. Being debounced means that it will only be executed after the time given by `timeInMs` has passed without invoking it.
**Signature:**
```typescript
export declare function debounce<Payload>(wire: Wire<Payload>, timeInMs: TimeSelector | number, options?: TimedWireOperatorOptions): Wire<Payload>;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
wire
</td><td>
[Wire](./x-components.wire.md)<!-- --><Payload>
</td><td>
The wire to debounce.
</td></tr>
<tr><td>
timeInMs
</td><td>
[TimeSelector](./x-components.timeselector.md) \| number
</td><td>
The time in milliseconds to debounce the wire execution or a function to retrieve it from the store.
</td></tr>
<tr><td>
options
</td><td>
[TimedWireOperatorOptions](./x-components.timedwireoperatoroptions.md)
</td><td>
_(Optional)_ Options to configure this wire with, like an event to force it or cancel it.
</td></tr>
</tbody></table>
**Returns:**
[Wire](./x-components.wire.md)<!-- --><Payload>
The Wire function with a debounced timing.