November: Procrastination Month

    @jslibrary/event-dispatcher

    1.0.0 • Public • Published

    event-dispatcher

    EventDispatcher class was created in order to be extended. It enables the addEventListener, removeEventListener and dispatchEvent methods in your class.

    Example

    import { EventDispatcher } from './EventDispatcher';
     
    export class Controller extends EventDispatcher {
        remoteMethod() {
            this.dispatchEvent(new CustomEvent("beforeRemoteCall");
            
            Rest.post(url, callback(data) {
                    this.dispatchEvent(new CustomEvent("afterRemoteCall", {detail: data});  
             });
        }
    }

    Instalation

    npm install --save event-dispatcher

    Install

    npm i @jslibrary/event-dispatcher

    DownloadsWeekly Downloads

    12

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    2.62 kB

    Total Files

    5

    Last publish

    Collaborators