How to use the dom-lib.on function in dom-lib

To help you get started, we’ve selected a few dom-lib 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 rsuite / rsuite / src / fixtures / Transition.js View on Github external
onTransitionEnd(node, handler) {
        this.setNextCallback(handler);

        if (node) {
            on(node, transitionEndEvent, this.nextCallback);
            setTimeout(this.nextCallback, this.props.timeout);
        } else {
            setTimeout(this.nextCallback, 0);
        }
    }
github rsuite / rsuite-table / src / utils / DOMMouseMoveTracker.js View on Github external
captureMouseMoves(event) {

        if (!this._eventMoveToken && !this._eventUpToken) {
            this._eventMoveToken = on(
                this._domNode,
                'mousemove',
                this._onMouseMove
            );
            this._eventUpToken = on(
                this._domNode,
                'mouseup',
                this._onMouseUp
            );
        }

        if (!this._isDragging) {
            this._deltaX = 0;
            this._deltaY = 0;
            this._isDragging = true;
            this._x = event.clientX;
github rsuite / rsuite / src / List / List.tsx View on Github external
activeNode.classList.add(addItemPrefix('holder'));
    this.activeNodeTranslateMin = {
      y:
        this.containerBoundingRect.top -
        this.activeNodeBoundingClientRect.top -
        this.activeNodeBoundingClientRect.height / 2
    };
    this.activeNodeTranslateMax = {
      y:
        this.containerBoundingRect.top +
        this.containerBoundingRect.height -
        this.activeNodeBoundingClientRect.top -
        this.activeNodeBoundingClientRect.height / 2
    };

    this.sortMouseMoveListener = on(window, 'mousemove', this.handleSortMove, { passive: false });
    this.sortMouseEndListener = on(window, 'mouseup', this.handleSortEnd, { passive: false });

    this.setState({ sorting: true });

    if (onSortStart) {
      onSortStart(
        {
          collection,
          node: activeNode,
          oldIndex: this.activeNodeOldIndex,
          newIndex: this.activeNodeNextIndex
        },
        event
      );
    }
  };
github rsuite / rsuite-table / src / Table.js View on Github external
this.calculateTableWidth();
    this.calculateTableContextHeight();
    this.calculateRowMaxHeight();
    this.setAffixHeaderOffset();
    this.initPosition();
    bindElementResize(this.table, _.debounce(this.calculateTableWidth, 400));

    const options = { passive: false };

    this.wheelListener = on(this.tableBody, 'wheel', this.wheelHandler.onWheel, options);
    this.touchStartListener = on(this.tableBody, 'touchstart', this.handleTouchStart, options);
    this.touchMoveListener = on(this.tableBody, 'touchmove', this.handleTouchMove, options);

    const { affixHeader } = this.props;
    if (affixHeader === 0 || affixHeader) {
      this.scrollListener = on(window, 'scroll', this.updateAffixHeaderStatus);
    }
  }
github rsuite / rsuite / src / Affix / Affix.tsx View on Github external
componentDidMount() {
    this.setContainerOffset();
    this.scrollListener = on(window, 'scroll', this.updatePosition);
    bindElementResize(this.containerRef.current, this.setContainerOffset);
  }
github rsuite / rsuite / src / List / List.js View on Github external
EVENTS.move.forEach((eventName: TouchEventTypes | MouseEventTypes) =>
      on(this.listenerNode, eventName, this.handleSortMove, { passive: false })
    );
github rsuite / rsuite / src / Modal / Modal.tsx View on Github external
handleShow = () => {
    const dialogElement = this.dialogRef.current;

    this.updateModalStyles(dialogElement);
    this.contentElement = dialogElement.querySelector(`.${this.addPrefix('content')}`);
    this.windowResizeListener = on(window, 'resize', this.handleResize);

    bindElementResize(this.contentElement, this.handleResize);
  };
  handleHide = () => {
github rsuite / rsuite / src / List / List.tsx View on Github external
this.activeNodeTranslateMin = {
      y:
        this.containerBoundingRect.top -
        this.activeNodeBoundingClientRect.top -
        this.activeNodeBoundingClientRect.height / 2
    };
    this.activeNodeTranslateMax = {
      y:
        this.containerBoundingRect.top +
        this.containerBoundingRect.height -
        this.activeNodeBoundingClientRect.top -
        this.activeNodeBoundingClientRect.height / 2
    };

    this.sortMouseMoveListener = on(window, 'mousemove', this.handleSortMove, { passive: false });
    this.sortMouseEndListener = on(window, 'mouseup', this.handleSortEnd, { passive: false });

    this.setState({ sorting: true });

    if (onSortStart) {
      onSortStart(
        {
          collection,
          node: activeNode,
          oldIndex: this.activeNodeOldIndex,
          newIndex: this.activeNodeNextIndex
        },
        event
      );
    }
  };
github rsuite / rsuite-table / src / Table.js View on Github external
componentDidMount() {
    this.calculateTableWidth();
    this.calculateTableContextHeight();
    this.calculateRowMaxHeight();
    this.setAffixHeaderOffset();
    this.initPosition();
    bindElementResize(this.table, _.debounce(this.calculateTableWidth, 400));

    const options = { passive: false };

    this.wheelListener = on(this.tableBody, 'wheel', this.wheelHandler.onWheel, options);
    this.touchStartListener = on(this.tableBody, 'touchstart', this.handleTouchStart, options);
    this.touchMoveListener = on(this.tableBody, 'touchmove', this.handleTouchMove, options);

    const { affixHeader } = this.props;
    if (affixHeader === 0 || affixHeader) {
      this.scrollListener = on(window, 'scroll', this.updateAffixHeaderStatus);
    }
  }
github rsuite / rsuite / src / fixtures / RootCloseWrapper.js View on Github external
bindRootCloseHandlers() {
        let doc = window.document;
        this._onDocumentClickListener = on(doc, 'click', this.handleDocumentClick);
        this._onDocumentKeyupListener = on(doc, 'keyup', this.handleDocumentKeyUp);
    },
    handleDocumentClick(event) {