function debounce(func, wait = 17, immediate = false) {
	let timeout;

	return function(...args) {
		const later = () => {
			timeout = null;

			if (! immediate) {
				func.apply(this, args);
			}
		};

		clearTimeout(timeout);
		timeout = setTimeout(later, wait);

		if (immediate && ! timeout) {
			func.apply(this, args);
		}
	};
}
/**
 * Control the execution rate of callbacks, i.e. for listeners
 * https://davidwalsh.name/function-debounce
 *
 * @param  Callable callback    The callback
 * @param  int      [ms]        Number of milliseconds, defaulting to 1/60th a second
 * @param  bool     [immediate] Trigger function immediately instead of after wait ms
 * @return function             Rate limited function
 */
Control the execution rate of callbacks, i.e.

@param  Callable callback    The callback
@param  int      [ms]        Number of milliseconds, defaulting to 1/60th a second
@param  bool     [immediate] Trigger function immediately instead of after wait ms
@return function             Rate limited function
Control the execution rate of callbacks i . e . @param Callable callback The callback @param int [ ms ] Number of milliseconds defaulting to 1 / 60th a second @param bool [ immediate ] Trigger function immediately instead of after wait ms @return function Rate limited function
function debounce(func, wait = 17, immediate = false) {
	let timeout;
	return function(...args) {
		const later = () => {
			timeout = null;
			if (! immediate) {
				func.apply(this, args);
			}
		};
		clearTimeout(timeout);
		timeout = setTimeout(later, wait);
		if (immediate && ! timeout) {
			func.apply(this, args);
		}
	};
}
function debounce ( func , wait = 17 , immediate = false ) { let timeout ; return function ( ... args ) { const later = ( ) => { timeout = null ; if ( ! immediate ) { func . apply ( this , args ) ; } } ; clearTimeout ( timeout ) ; timeout = setTimeout ( later , wait ) ; if ( immediate && ! timeout ) { func . apply ( this , args ) ; } } ; }
Control the execution rate of callbacks, i.e.
Control the execution rate of callbacks i . e .