ebs.debounce

Delays the execution of a function for a preset time after it was invoked. If the function is triggered again during the waiting period, the delay is reset.

HINT  
ebs.debounce allows you to prevent function calls until the call rate for that function falls below a specific threshold. For instance, a function that displays search suggestions can be triggered at a specific time after the user has stopped typing, instead of being triggered repeatedly on every key press.

Syntax

Copy
function ebs.debounce(func: Function, wait: number, immediate: boolean): () => any;
 
Parameter Type Description
func Function Function to be debounced.
wait number Delay period in milliseconds.
immediate boolean If true, triggers the function immediately, then applies the delay(s) when the function calls are not allowed.

Return Value

Returns a function (closure) with the bound variables in the debounce scope.

Examples