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

ParameterRequiredTypeDescription
eventstring or string[]The daily-js event(s) to register
callbackFunctionA memoized callback reference to run when the event(s) get emitted
throttleTimeoutintegerThe 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

Sample code

Sample code for multiple events

Related references