src/utils/debounce.js
/**
 * Function to create a debounce function
 * @param {function} func Function to debounce
 * @param {number} msWait Number of milliseconds to wait before calling function
 * @returns {function} Debounce function
 */
Function to create a debounce function
@param {function} func Function to debounce
@param {number} msWait Number of milliseconds to wait before calling function
@returns {function} Debounce function
Function to create a debounce function @param { function } func Function to debounce @param { number } msWait Number of milliseconds to wait before calling function @returns { function } Debounce function
function debounce (func, msWait) {
  let timeout
  return function (...args) {
    const context = this
    clearTimeout(timeout)
    timeout = setTimeout(() => func.apply(context, args), msWait)
  }
}
function debounce ( func , msWait ) { let timeout return function ( ... args ) { const context = this clearTimeout ( timeout ) timeout = setTimeout ( ( ) => func . apply ( context , args ) , msWait ) } }
Function to create a debounce function
 @param {function} func Function to debounce
 @param {number} msWait Number of milliseconds to wait before calling function
 @returns {function} Debounce function
Function to create a debounce function @param { function } func Function to debounce @param { number } msWait Number of milliseconds to wait before calling function @returns { function } Debounce function