Sha256: 88e540159fae002ef1517c39de16c87ef988ffee2879ca0d131c84465aa133fa

Contents?: true

Size: 505 Bytes

Versions: 15

Compression:

Stored size: 505 Bytes

Contents

export let eventHandlerMixin = Base => class extends Base {
    // idempotent event handling initialization
    initEventListener(eventName, eventHandler) {
        if (typeof this.eventsHandler === 'undefined') {
            this.eventsHandler = {};
        }
        if (!this.eventsHandler[eventName]) {
            // Delegate to the component if possible
            this.eventsHandler[eventName] = eventHandler;
            this.element.addEventListener(eventName, eventHandler);
        }
    }
};

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
voom-presenters-0.2.0 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.13 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.12 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.11 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.10 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.9 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.8 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.7 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.6 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.5 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.4 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.3 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.2 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.1 views/mdc/assets/js/components/mixins/event-handler.js
voom-presenters-0.1.0 views/mdc/assets/js/components/mixins/event-handler.js