throttle
function throttle(func: Function, limit: number): (...args: any[]) => void
Throttles a function so it can be only invoked once per specified time period.
const throttled = throttle(() => console.log('Throttled!'), 1000);
throttled(); // 'Throttled!' (invoked immediately)
throttled(); // (No output) (invoked after 1 second)
Parameter
Type
Optional
Description
func
Function
❌
The function to throttle
limit
number
❌
The time period in milliseconds
Last updated