Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)));
}
}
}
}
created() {
this.eventHandler_ = new EventHandler();
this.on('select', this.select);
}
addListenersFromObj_(obj) {
if (!this.eventsStateKeyHandler_) {
this.eventsStateKeyHandler_ = new EventHandler();
}
const handles = addListenersFromObj(this, obj);
this.eventsStateKeyHandler_.add(...handles);
}
created() {
this.eventHandler_ = new EventHandler();
}
addListenersFromObj_(obj) {
if (!this.eventsStateKeyHandler_) {
this.eventsStateKeyHandler_ = new EventHandler();
}
const handles = addListenersFromObj(this, obj);
this.eventsStateKeyHandler_.add(...handles);
}
* @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_();
created() {
this.currentAlignElement = this.alignElement;
this.eventHandler_ = new EventHandler();
}