How to use the @react-md/utils.removeTouchEvent function in @react-md/utils

To help you get started, we’ve selected a few @react-md/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mlaursen / react-md / packages / tooltip / src / MagicTooltipProvider.tsx View on Github external
public componentWillUnmount() {
    this.clearShowTimeout();
    this.clearFocusTimeout();
    this.clearHoverModeTimeout();
    window.removeEventListener("blur", this.handleBlur, true);
    window.removeEventListener("focus", this.handleFocus, true);
    window.removeEventListener("keydown", this.handleKeyDown, true);
    removeTouchEvent(window, "start", this.handleTouchStart, true);
    removeTouchEvent(window, "end", this.handleTouchEnd, true);
    this.clearContainers();
  }
github mlaursen / react-md / packages / tooltip / src / MagicTooltipProvider.tsx View on Github external
private handleTouchEnd = (event: TouchEvent) => {
    removeTouchEvent(window, "end", this.handleTouchEnd, true);
    window.requestAnimationFrame(() => {
      this.touched = false;
    });
  };
}
github mlaursen / react-md / packages / listeners / src / touchKeyboardFix.ts View on Github external
export function stopListening() {
  listeners = Math.max(0, listeners - 1);
  if (listeners === 0) {
    window.clearTimeout(timeout);
    timeout = undefined;

    if (focusAdded) {
      window.removeEventListener("focus", handleFocus, true);
      focusAdded = false;
    }

    if (touchStartAdded) {
      removeTouchEvent(window, "start", handleTouchStart);
      touchStartAdded = false;
    }
  }
}
github mlaursen / react-md / packages / listeners / src / ResizeListener.tsx View on Github external
public componentWillUnmount() {
    window.clearTimeout(this.touchMoveTimeout);
    removeTouchEvent(window, "move", this.handleTouchMove);

    if (this.resizeHandler) {
      this.resizeHandler.remove(this.handleResize);
    }

    if (!this.props.disableTouchKeyboardFixes) {
      stopListening();
    }
  }
github mlaursen / react-md / packages / tooltip / src / MagicTooltipProvider.tsx View on Github external
public componentWillUnmount() {
    this.clearShowTimeout();
    this.clearFocusTimeout();
    this.clearHoverModeTimeout();
    window.removeEventListener("blur", this.handleBlur, true);
    window.removeEventListener("focus", this.handleFocus, true);
    window.removeEventListener("keydown", this.handleKeyDown, true);
    removeTouchEvent(window, "start", this.handleTouchStart, true);
    removeTouchEvent(window, "end", this.handleTouchEnd, true);
    this.clearContainers();
  }
github mlaursen / react-md / packages / listeners / src / touchKeyboardFix.ts View on Github external
function handleTouchEnd() {
  removeTouchEvent(window, "end", handleTouchEnd, true);
  touchEndAdded = false;

  window.clearTimeout(focusResetTimeout);
  focusResetTimeout = window.setTimeout(() => {
    focusResetTimeout = undefined;
    if (focusAdded) {
      window.removeEventListener("focus", handleFocus, true);
      focusAdded = false;
    }
  }, KEYBOARD_WAIT);
}
github mlaursen / react-md / packages / listeners / src / ResizeListener.tsx View on Github external
private updateTouch = () => {
    if (!this.props.disableTouchFixes) {
      addTouchEvent(window, "move", this.handleTouchMove);
    } else {
      removeTouchEvent(window, "move", this.handleTouchMove);
    }
  };