Sign up (with export icon)

utils/dom/emittermixin

Api-module icon module

Interfaces

Functions

  • Chevron-right icon

    DomEmitterMixin( base ) → Mixed<Base, DomEmitter>

    Mixin that injects the DOM events API into its host. It provides the API compatible with Emitter.

    This function creates a class that inherits from the provided base and implements Emitter interface.

    DOM emitter mixin is by default available in the View class, but it can also be mixed into any other class:

    import { DomEmitterMixin } from '../utils/dom/emittermixin.js';
    
    class BaseClass { ... }
    
    class SomeView extends DomEmitterMixin( BaseClass ) {}
    
    const view = new SomeView();
    view.listenTo( domElement, ( evt, domEvt ) => {
    	console.log( evt, domEvt );
    } );
    
    Copy code

    Type parameters

    Base : extends Constructor<Emitter>

    Parameters

    base : Base

    Returns

    Mixed<Base, DomEmitter>
  • Chevron-right icon

    DomEmitterMixin() → new () => DomEmitter

    Mixin that injects the DOM events API into its host. It provides the API compatible with Emitter.

    This function creates a class that implements Emitter interface.

    DOM emitter mixin is by default available in the View class, but it can also be mixed into any other class:

    import { DomEmitterMixin } from '../utils/dom/emittermixin.js';
    
    class SomeView extends DomEmitterMixin() {}
    
    const view = new SomeView();
    view.listenTo( domElement, ( evt, domEvt ) => {
    	console.log( evt, domEvt );
    } );
    
    Copy code

    Returns

    new () => DomEmitter