docs: function(element, eventHandlers, pointerTypes) {
        // Absolute total movement, used to control swipe vs. scroll.
        var totalX, totalY;
        // Coordinates of the start position.
        var startCoords;
        // Last event's position.
        var lastPos;
        // Whether a swipe is active.
        var active = false;
  
        pointerTypes = pointerTypes || ['mouse', 'touch', 'pointer'];
        element.on(getEvents(pointerTypes, 'start'), function(event) {
          startCoords = getCoordinates(event);
          active = true;
          totalX = 0;
          totalY = 0;
          lastPos = startCoords;
          if (eventHandlers['start']) {
            eventHandlers['start'](startCoords, event);
          }
        });
        var events = getEvents(pointerTypes, 'cancel');
        if (events) {
          element.on(events, function(event) {
            active = false;
            if (eventHandlers['cancel']) {
              eventHandlers['cancel'](event);
            }
          });
        }
  
        element.on(getEvents(pointerTypes, 'move'), function(event) {
          if (!active) return;
  
          // Android will send a touchcancel if it thinks we're starting to scroll.
          // So when the total distance (+ or - or both) exceeds 10px in either direction,
          // we either:
          // - On totalX > totalY, we send preventDefault() and treat this as a swipe.
          // - On totalY > totalX, we let the browser handle it as a scroll.
  
          if (!startCoords) return;
          var coords = getCoordinates(event);
  
          totalX += Math.abs(coords.x - lastPos.x);
          totalY += Math.abs(coords.y - lastPos.y);
  
          lastPos = coords;
  
          if (totalX < MOVE_BUFFER_RADIUS && totalY < MOVE_BUFFER_RADIUS) {
            return;
          }
  
          // One of totalX or totalY has exceeded the buffer, so decide on swipe vs. scroll.
          if (totalY > totalX) {
            // Allow native scrolling to take over.
            active = false;
            if (eventHandlers['cancel']) {
              eventHandlers['cancel'](event);
            }
            return;
          } else {
            // Prevent the browser from scrolling.
            event.preventDefault();
            if (eventHandlers['move']) {
              eventHandlers['move'](coords, event);
            }
          }
        });
  
        element.on(getEvents(pointerTypes, 'end'), function(event) {
          if (!active) return;
          active = false;
          if (eventHandlers['end']) {
            eventHandlers['end'](getCoordinates(event), event);
          }
        });
      }