debounce (func, waitTime, immediate) {
		let timeout;
		return function () {
			const context = this;
			const args = arguments;
			const later = function () {
				timeout = null;
				func.apply(context, args);
				if (!immediate) func.apply(context, args);
			};
			const callNow = immediate && !timeout;
			clearTimeout(timeout);
			timeout = setTimeout(later, waitTime);
			if (callNow) func.apply(context, args);
		};
	}
/**
	 * @param func The function to debounce.
	 * @param waitTime Minimum duration between calls.
	 * @param immediate Trigger on leading edge, as opposed to trailing.
	 * @return {Function} The debounced function.
	 */
@param func The function to debounce.
@param waitTime Minimum duration between calls.
@param immediate Trigger on leading edge, as opposed to trailing.
@return {Function} The debounced function.
@param func The function to debounce . @param waitTime Minimum duration between calls . @param immediate Trigger on leading edge as opposed to trailing . @return { Function } The debounced function .
debounce (func, waitTime, immediate) {
		let timeout;
		return function () {
			const context = this;
			const args = arguments;
			const later = function () {
				timeout = null;
				func.apply(context, args);
				if (!immediate) func.apply(context, args);
			};
			const callNow = immediate && !timeout;
			clearTimeout(timeout);
			timeout = setTimeout(later, waitTime);
			if (callNow) func.apply(context, args);
		};
	}
debounce ( func , waitTime , immediate ) { let timeout ; return function ( ) { const context = this ; const args = arguments ; const later = function ( ) { timeout = null ; func . apply ( context , args ) ; if ( ! immediate ) func . apply ( context , args ) ; } ; const callNow = immediate && ! timeout ; clearTimeout ( timeout ) ; timeout = setTimeout ( later , waitTime ) ; if ( callNow ) func . apply ( context , args ) ; } ; }
@param func The function to debounce.
@param func The function to debounce .