Skip to content

Latest commit

 

History

History
 
 

event-emitter

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

EventEmitter

Abstract class for event listener and triggerer.

Installation

npm install @pencil.js/event-emitter

Examples

import EventEmitter from "@pencil.js/event-emitter";

class MyEmitter extends EventEmitter {
    /**
     * @override EventEmitter.prototype.fire
     */
    fire (event) {
        super.fire(event);
        const trigger = `on${capitalize(event.name)}`;
        if (target[trigger]) {
            target[trigger](event);
        }
    }
}