Creates a throttled function that only invokes func at most once per every animation frame using
requestAnimationFrame. The func will be invoked with the context and arguments of the throttled function.
This function is intended for use in environments where requestAnimationFrame is available. It does not contain a
polyfill for server-side environments.
Example
// Avoid costly calculations while the window size is in flux. window.addEventListener.on('resize', throttle(calculateLayout))
Creates a throttled function that only invokes
func
at most once per every animation frame usingrequestAnimationFrame
. Thefunc
will be invoked with the context and arguments of the throttled function.