Saltar al contenido principal

Function: useThrottle()

useThrottle<T>(func, limitMs): (...args) => void

Defined in: src/core/services/timing.service.ts:248

Returns a throttled version of func that fires at most once per limitMs milliseconds (leading edge).

Type Parameters

T

T extends (...args) => unknown

The wrapped function type.

Parameters

func

T

Function to throttle.

limitMs

number

Minimum interval between invocations in milliseconds.

Returns

A throttled function with the same signature.

(...args) => void

Example

const throttledScroll = useThrottle(onScroll, 100);
window.addEventListener("scroll", throttledScroll);