UNPKG

@empathyco/x-components

Version:
89 lines (41 loc) 1.49 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [throttle](./x-components.throttle.md) ## throttle() function Creates a throttled [Wire](./x-components.wire.md)<!-- -->. Being throttled means that it will only be executed once every couple of milliseconds given by the `timeInMs` parameter. **Signature:** ```typescript export declare function throttle<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)<!-- -->&lt;Payload&gt; </td><td> The wire to throttle. </td></tr> <tr><td> timeInMs </td><td> [TimeSelector](./x-components.timeselector.md) \| number </td><td> The time in milliseconds to throttle 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)<!-- -->&lt;Payload&gt; The Wire function with a throttle timing.