How to use the metal-events.EventHandler function in metal-events

To help you get started, we’ve selected a few metal-events 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 metal / metal.js / packages / metal-component / src / EventsCollector.js View on Github external
attachListener(eventType, fnNamesString) {
		var selector = '[data-on' + eventType + '="' + fnNamesString + '"]';

		this.hasListener_[selector] = true;

		if (!this.eventHandles_[selector]) {
			this.eventHandles_[selector] = new EventHandler();
			var fnNames = fnNamesString.split(',');
			for (var i = 0; i < fnNames.length; i++) {
				var fn = this.component_.getListenerFn(fnNames[i]);
				if (fn) {
					this.eventHandles_[selector].add(this.component_.delegate(eventType, selector, this.onEvent_.bind(this, fn)));
				}
			}
		}
	}
github LiferayCloud / marble / packages / marble-autocomplete / src / AutocompleteBase.js View on Github external
created() {
    this.eventHandler_ = new EventHandler();
    this.on('select', this.select);
  }
github metal / metal.js / packages / metal-component / src / Component.js View on Github external
addListenersFromObj_(obj) {
		if (!this.eventsStateKeyHandler_) {
			this.eventsStateKeyHandler_ = new EventHandler();
		}
		const handles = addListenersFromObj(this, obj);
		this.eventsStateKeyHandler_.add(...handles);
	}
github metal / metal.js / packages / metal-component / src / Component.js View on Github external
addListenersFromObj_(obj) {
		if (!this.eventsStateKeyHandler_) {
			this.eventsStateKeyHandler_ = new EventHandler();
		}
		const handles = addListenersFromObj(this, obj);
		this.eventsStateKeyHandler_.add(...handles);
	}
github liferay / senna.js / src / app / App.js View on Github external
* @default {}
		 * @protected
		 */
		this.surfaces = {};

		/**
		 * When set to true, moves the scroll position after popstate, or to the
		 * top of the viewport for new navigation. If false, the browser will
		 * take care of scroll restoration.
		 * @type {!boolean}
		 * @default true
		 * @protected
		 */
		this.updateScrollPosition = true;

		this.appEventHandlers_ = new EventHandler();

		this.appEventHandlers_.add(
			on(globals.window, 'scroll', debounce(this.onScroll_.bind(this), 100)),
			on(globals.window, 'load', this.onLoad_.bind(this)),
			on(globals.window, 'popstate', this.onPopstate_.bind(this))
		);

		this.on('startNavigate', this.onStartNavigate_);
		this.on('beforeNavigate', this.onBeforeNavigate_);
		this.on('beforeNavigate', this.onBeforeNavigateDefault_, true);
		this.on('beforeUnload', this.onBeforeUnloadDefault_);

		this.setLinkSelector(this.linkSelector);
		this.setFormSelector(this.formSelector);

		this.maybeOverloadBeforeUnload_();
github LiferayCloud / marble / packages / marble-tooltip / src / TooltipBase.js View on Github external
created() {
    this.currentAlignElement = this.alignElement;
    this.eventHandler_ = new EventHandler();
  }

metal-events

Classes responsible for emitting and listening to events

BSD
Latest version published 6 years ago

Package Health Score

57 / 100
Full package analysis