function wrapper(...arguments_) {
    const self = this;
    const elapsed = Date.now() - lastExec;

    if (cancelled) {
      return;
    }

    // Execute `callback` and update the `lastExec` timestamp.
    function exec() {
      lastExec = Date.now();
      callback.apply(self, arguments_);
    }

    /*
         * If `debounceMode` is true (at begin) this is used to clear the flag
         * to allow future `callback` executions.
         */
    function clear() {
      timeoutID = undefined;
    }

    if (debounceMode && !timeoutID) {
      /*
             * Since `wrapper` is being called for the first time and
             * `debounceMode` is true (at begin), execute `callback`.
             */
      exec();
    }

    clearExistingTimeout();

    if (debounceMode === undefined && elapsed > delay) {
      /*
             * In throttle mode, if `delay` time has been exceeded, execute
             * `callback`.
             */
      exec();
    } else if (noTrailing !== true) {
      /*
             * In trailing throttle mode, since `delay` time has not been
             * exceeded, schedule `callback` to execute `delay` ms after most
             * recent execution.
             *
             * If `debounceMode` is true (at begin), schedule `clear` to execute
             * after `delay` ms.
             *
             * If `debounceMode` is false (at end), schedule `callback` to
             * execute after `delay` ms.
             */
      timeoutID = setTimeout(
        debounceMode ? clear : exec,
        debounceMode === undefined ? delay - elapsed : delay,
      );
    }
  }
/*
     * The `wrapper` function encapsulates all of the throttling / debouncing
     * functionality and when executed will limit the rate at which `callback`
     * is executed.
     */
The `wrapper` function encapsulates all of the throttling / debouncing
functionality and when executed will limit the rate at which `callback`
is executed.
The ` wrapper ` function encapsulates all of the throttling / debouncing functionality and when executed will limit the rate at which ` callback ` is executed .
function wrapper(...arguments_) {
    const self = this;
    const elapsed = Date.now() - lastExec;
    if (cancelled) {
      return;
    }
    function exec() {
      lastExec = Date.now();
      callback.apply(self, arguments_);
    }
    function clear() {
      timeoutID = undefined;
    }
    if (debounceMode && !timeoutID) {
      exec();
    }
    clearExistingTimeout();
    if (debounceMode === undefined && elapsed > delay) {
      exec();
    } else if (noTrailing !== true) {
      timeoutID = setTimeout(
        debounceMode ? clear : exec,
        debounceMode === undefined ? delay - elapsed : delay,
      );
    }
  }
function wrapper ( ... arguments_ ) { const self = this ; const elapsed = Date . now ( ) - lastExec ; if ( cancelled ) { return ; } function exec ( ) { lastExec = Date . now ( ) ; callback . apply ( self , arguments_ ) ; } function clear ( ) { timeoutID = undefined ; } if ( debounceMode && ! timeoutID ) { exec ( ) ; } clearExistingTimeout ( ) ; if ( debounceMode === undefined && elapsed > delay ) { exec ( ) ; } else if ( noTrailing !== true ) { timeoutID = setTimeout ( debounceMode ? clear : exec , debounceMode === undefined ? delay - elapsed : delay , ) ; } }
The `wrapper` function encapsulates all of the throttling / debouncing
 functionality and when executed will limit the rate at which `callback`
 is executed.
The ` wrapper ` function encapsulates all of the throttling / debouncing functionality and when executed will limit the rate at which ` callback ` is executed .
// Execute `callback` and update the `lastExec` timestamp. /*
         * If `debounceMode` is true (at begin) this is used to clear the flag
         * to allow future `callback` executions.
         */ /*
             * Since `wrapper` is being called for the first time and
             * `debounceMode` is true (at begin), execute `callback`.
             */ /*
             * In throttle mode, if `delay` time has been exceeded, execute
             * `callback`.
             */ /*
             * In trailing throttle mode, since `delay` time has not been
             * exceeded, schedule `callback` to execute `delay` ms after most
             * recent execution.
             *
             * If `debounceMode` is true (at begin), schedule `clear` to execute
             * after `delay` ms.
             *
             * If `debounceMode` is false (at end), schedule `callback` to
             * execute after `delay` ms.
             */