The function to throttle
How many milliseconds to wait before running the function again.
A throttled function.
Throttling limits the execution to a fixed number of times over an interval. Throttling is suited for controlling the execution rate of functions called in response to events like scrolling or resizing.
Note that this cannot be converted to an arrow function, because the context
of this
is important during the call. Arrow functions significantly change the
way the context is managed.
Returns a throttled function that limits calls to the original function to at most once every wait milliseconds. It guarantees execution after the final invocation and maintains the last context (this) and arguments.