A utility that creates a resource allowing us to throttle execution of a function.
Especially useful for rate limiting execution of handlers on events like resize and scroll.
// immediately returns 'initial', and all updates will be throttled // to update only after 100ms since the last value was detected. @useuserInput = throttle(100, () =>this._userInput);
Type Parameters
Value = unknown
Parameters
delay: number
A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.
A utility that creates a resource allowing us to throttle execution of a function. Especially useful for rate limiting execution of handlers on events like resize and scroll.