The function to throttle.
The duration of a throttle window, in milliseconds.
Optionaloptions: { leading?: boolean; trailing?: boolean }
Throttle behavior options.
Optionalleading?: booleanInvokes fn immediately on the first call of a throttle window.
Defaults to true.
Optionaltrailing?: booleanInvokes fn once more at the end of the window if calls happened
during it. Defaults to true.
An object with throttled, the throttled function to call instead of fn, and
cancel, which cancels any pending trailing invocation and resets the throttle window.
Wraps a function so that calls are grouped into throttle windows of
waitmilliseconds. Mirrors lodash'sthrottleAPI.A window starts on the first call made outside of a window.
fnis invoked at most once at the start of the window (leading) and at most once at its end with the latest arguments (trailing). Unlike lodash, the trailing invocation does not start a new window: a call made right after it starts a new window and may invokefnagain immediately.