How to use the metal-dom.delegate function in metal-dom

To help you get started, we’ve selected a few metal-dom 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 LiferayCloud / marble / packages / marble-tooltip / src / TooltipBase.js View on Github external
dom.delegate(
          document,
          triggerEvents[0],
          selector,
          this.handleToggle.bind(this)
        )
      );
    } else {
      this.eventHandler_.add(
        dom.delegate(
          document,
          triggerEvents[0],
          selector,
          this.handleShow.bind(this)
        ),
        dom.delegate(
          document,
          triggerEvents[1],
          selector,
          this.handleHide.bind(this)
        )
      );
    }
  }
github LiferayCloud / marble / packages / marble-tooltip / src / TooltipBase.js View on Github external
this.on('mouseenter', this.lock),
      this.on('mouseleave', this.unlock)
    );

    if (triggerEvents[0] === triggerEvents[1]) {
      this.eventHandler_.add(
        dom.delegate(
          document,
          triggerEvents[0],
          selector,
          this.handleToggle.bind(this)
        )
      );
    } else {
      this.eventHandler_.add(
        dom.delegate(
          document,
          triggerEvents[0],
          selector,
          this.handleShow.bind(this)
        ),
        dom.delegate(
          document,
          triggerEvents[1],
          selector,
          this.handleHide.bind(this)
        )
      );
    }
  }
github liferay / senna.js / src / app / App.js View on Github external
setLinkSelector(linkSelector) {
		this.linkSelector = linkSelector;
		if (this.linkEventHandler_) {
			this.linkEventHandler_.removeListener();
		}
		this.linkEventHandler_ = delegate(document, 'click', this.linkSelector, this.onDocClickDelegate_.bind(this), this.allowPreventNavigate);
	}
github metal / metal.js / packages / metal-incremental-dom / src / render / attributes.js View on Github external
function attachEvent_(component, element, attr, eventName, fn) {
	if (isServerSide()) {
		return;
	}
	const handleKey = eventName + HANDLE_SUFFIX;
	if (element[handleKey]) {
		element[handleKey].removeListener();
		element[handleKey] = null;
	}
	if (fn) {
		element[attr] = fn;
		element[handleKey] = delegate(document, eventName, element, fn);
	}
}
github liferay / senna.js / src / app / App.js View on Github external
setFormSelector(formSelector) {
		this.formSelector = formSelector;
		if (this.formEventHandler_) {
			this.formEventHandler_.removeListener();
		}
		this.formEventHandler_ = delegate(document, 'submit', this.formSelector, this.onDocSubmitDelegate_.bind(this), this.allowPreventNavigate);
	}