performance

Methods

(static) debounce(callback, wait, immediate, valueThis) → {function}

Description:
  • Returns a function, that, as long as it continues to be invoked, will not be triggered

Source:
Author:
  • David Walsh - https://davidwalsh.name/javascript-debounce-function - Updated to have cancel method
Parameters:
Name Type Description
callback function

Function to invoke

wait Number

Amount of time after (milliseconds)

immediate Boolean

trigger the function on the leading edge, instead of the trailing.

valueThis Object

Context for function

Returns:

A new debounced function. It also includes a .cancel() method to clear any pending execution.

Type
function

(static) throttle(timer) → {function}

Description:
  • Reusable throttle creator

Source:
Parameters:
Name Type Description
timer function

Function like requestAnimationFrame

Returns:

Function to be used to create throttled functions based on passed timer

Type
function