Module

utils/dom/emittermixin

@ckeditor/ckeditor5-utils/src/dom/emittermixin

module

Filtering

Interfaces

  • DomEmitter

  • DomEventMap

Functions

  • 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 );
    } );
    

    Type parameters

    Base : extends Constructor<Emitter>

    Parameters

    base : Base

    Returns

    Mixed<Base, DomEmitter>
  • 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 );
    } );
    

    Returns

    new () => DomEmitter