handler(event) {

    event.preventDefault();
    let value = event.deltaY;
    // Firefox doubles the values on retina screens...
    if (firefox && event.deltaMode === window.WheelEvent.DOM_DELTA_PIXEL) {
      value /= window.devicePixelRatio;
    }
    if (event.deltaMode === window.WheelEvent.DOM_DELTA_LINE) {
      value *= WHEEL_DELTA_PER_LINE;
    }

    let {
      type,
      timeout,
      lastValue,
      time
    } = this;

    const now = (window.performance || Date).now();
    const timeDelta = now - (time || 0);

    this.wheelPosition = {
      x: event.clientX,
      y: event.clientY
    };
    time = now;

    if (value !== 0 && value % WHEEL_DELTA_MAGIC_SCALER === 0) {
      // This one is definitely a mouse wheel event.
      type = 'wheel';
      // Normalize this value to match trackpad.
      value = Math.floor(value / WHEEL_DELTA_MAGIC_SCALER);
    } else if (value !== 0 && Math.abs(value) < TRACKPAD_MAX_DELTA) {
      // This one is definitely a trackpad event because it is so small.
      type = 'trackpad';
    } else if (timeDelta > 400) {
      // This is likely a new scroll action.
      type = null;
      lastValue = value;
      // Start a timeout in case this was a singular event,
      // and delay it by up to 40ms.
      timeout = window.setTimeout(function setTimeout() {
        this._onWheel(event, -lastValue, this.wheelPosition);
        type = 'wheel';
      }.bind(this), 40);
    } else if (!type) {
      // This is a repeating event, but we don't know the type of event just yet.
      // If the delta per time is small, we assume it's a fast trackpad;
      // otherwise we switch into wheel mode.
      type = Math.abs(timeDelta * value) < TRACKPAD_MAX_DELTA_PER_TIME ? 'trackpad' : 'wheel';

      // Make sure our delayed event isn't fired again, because we accumulate
      // the previous event (which was less than 40ms ago) into this event.
      if (timeout) {
        window.clearTimeout(timeout);
        timeout = null;
        value += lastValue;
      }
    }

    if (event.shiftKey && value) {
      value = value * SHIFT_MULTIPLIER;
    }

    // Only fire the callback if we actually know
    // what type of scrolling device the user uses.
    if (type) {
      this._onWheel(event, -value, this.wheelPosition);
    }
  }
/* eslint-disable complexity, max-statements */
eslint-disable complexity, max-statements
eslint - disable complexity max - statements
handler(event) {
    event.preventDefault();
    let value = event.deltaY;
    if (firefox && event.deltaMode === window.WheelEvent.DOM_DELTA_PIXEL) {
      value /= window.devicePixelRatio;
    }
    if (event.deltaMode === window.WheelEvent.DOM_DELTA_LINE) {
      value *= WHEEL_DELTA_PER_LINE;
    }
    let {
      type,
      timeout,
      lastValue,
      time
    } = this;
    const now = (window.performance || Date).now();
    const timeDelta = now - (time || 0);
    this.wheelPosition = {
      x: event.clientX,
      y: event.clientY
    };
    time = now;
    if (value !== 0 && value % WHEEL_DELTA_MAGIC_SCALER === 0) {
      type = 'wheel';
      value = Math.floor(value / WHEEL_DELTA_MAGIC_SCALER);
    } else if (value !== 0 && Math.abs(value) < TRACKPAD_MAX_DELTA) {
      type = 'trackpad';
    } else if (timeDelta > 400) {
      type = null;
      lastValue = value;
      timeout = window.setTimeout(function setTimeout() {
        this._onWheel(event, -lastValue, this.wheelPosition);
        type = 'wheel';
      }.bind(this), 40);
    } else if (!type) {
      type = Math.abs(timeDelta * value) < TRACKPAD_MAX_DELTA_PER_TIME ? 'trackpad' : 'wheel';
      if (timeout) {
        window.clearTimeout(timeout);
        timeout = null;
        value += lastValue;
      }
    }
    if (event.shiftKey && value) {
      value = value * SHIFT_MULTIPLIER;
    }
    if (type) {
      this._onWheel(event, -value, this.wheelPosition);
    }
  }
handler ( event ) { event . preventDefault ( ) ; let value = event . deltaY ; if ( firefox && event . deltaMode === window . WheelEvent . DOM_DELTA_PIXEL ) { value /= window . devicePixelRatio ; } if ( event . deltaMode === window . WheelEvent . DOM_DELTA_LINE ) { value *= WHEEL_DELTA_PER_LINE ; } let { type , timeout , lastValue , time } = this ; const now = ( window . performance || Date ) . now ( ) ; const timeDelta = now - ( time || 0 ) ; this . wheelPosition = { x : event . clientX , y : event . clientY } ; time = now ; if ( value !== 0 && value % WHEEL_DELTA_MAGIC_SCALER === 0 ) { type = 'wheel' ; value = Math . floor ( value / WHEEL_DELTA_MAGIC_SCALER ) ; } else if ( value !== 0 && Math . abs ( value ) < TRACKPAD_MAX_DELTA ) { type = 'trackpad' ; } else if ( timeDelta > 400 ) { type = null ; lastValue = value ; timeout = window . setTimeout ( function setTimeout ( ) { this . _onWheel ( event , - lastValue , this . wheelPosition ) ; type = 'wheel' ; } . bind ( this ) , 40 ) ; } else if ( ! type ) { type = Math . abs ( timeDelta * value ) < TRACKPAD_MAX_DELTA_PER_TIME ? 'trackpad' : 'wheel' ; if ( timeout ) { window . clearTimeout ( timeout ) ; timeout = null ; value += lastValue ; } } if ( event . shiftKey && value ) { value = value * SHIFT_MULTIPLIER ; } if ( type ) { this . _onWheel ( event , - value , this . wheelPosition ) ; } }
eslint-disable complexity, max-statements
eslint - disable complexity max - statements
// Firefox doubles the values on retina screens... // This one is definitely a mouse wheel event. // Normalize this value to match trackpad. // This one is definitely a trackpad event because it is so small. // This is likely a new scroll action. // Start a timeout in case this was a singular event, // and delay it by up to 40ms. // This is a repeating event, but we don't know the type of event just yet. // If the delta per time is small, we assume it's a fast trackpad; // otherwise we switch into wheel mode. // Make sure our delayed event isn't fired again, because we accumulate // the previous event (which was less than 40ms ago) into this event. // Only fire the callback if we actually know // what type of scrolling device the user uses.