public/js/searchTopics.js
// debounce data every 500ms from each 2 keystrokes
debounce data every 500ms from each 2 keystrokes
debounce data every 500ms from each 2 keystrokes
function debounce(func, wait, immediate) {
  let timeout;
  return function () {
    let context = this;
    args = arguments;
    let later = () => {
      timeout = null;
      if (!immediate) func.apply(context, args);
    };
    let callNow = immediate && !timeout;
    clearTimeout(timeout);
    timeout = setTimeout(later, wait);
    if (callNow) func.apply(context, args);
  };
}
function debounce ( func , wait , immediate ) { let timeout ; return function ( ) { let context = this ; args = arguments ; let later = ( ) => { timeout = null ; if ( ! immediate ) func . apply ( context , args ) ; } ; let callNow = immediate && ! timeout ; clearTimeout ( timeout ) ; timeout = setTimeout ( later , wait ) ; if ( callNow ) func . apply ( context , args ) ; } ; }
debounce data every 500ms from each 2 keystrokes
debounce data every 500ms from each 2 keystrokes