sajad torkamani

In a nutshell

This is the method signature:

_.debounce(func, [wait=0], [options={}])

Lodash’s debounce function creates a “debounced” function that delays invoking the given func until after wait milliseconds have elapsed since the last invocation.


// Avoid costly calculations while the window size is in flux.
jQuery(window).on('resize', _.debounce(calculateLayout, 150));

// Cancel the trailing debounced invocation.
jQuery(window).on('popstate', debounced.cancel);

Other notes