useThrottledDailyEvent
useThrottledDailyEvent(params): void
Registers daily-js
event listeners. The listeners are automatically torn down when a component or hook calling useThrottledDailyEvent
gets unmounted.
In comparison to useDailyEvent, the callback passed here will be called with an array of event objects.
The throttled event queue is automatically cleared when daily-js
emits the 'call-instance-destroyed'
event.
Params
Parameter | Required | Type | Description |
---|---|---|---|
event | ✓ | string or string[] | The daily-js event(s) to register |
callback | ✓ | Function | A memoized callback reference to run when the event(s) get emitted |
throttleTimeout | integer | The minimum waiting time until the callback is called again. Default: 100 |
The callback
param has to be a memoized reference (e.g. via useCallback
). Otherwise a console error might be thrown indicating a re-render loop.
Return type
void