Naval Pilgrim's Mayflower

    lite-event-emitter
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.2 • Public • Published

    lite-event-emitter

    A very simple and light event emitter.

    flask

    NPM version NPM downloads Travis Status codecov

    install

    • npm install lite-event-emitter

    Usage

    on

    import {LiteEventEmitter} from 'lite-event-emitter'
     
    let events = new LiteEventEmitter();
     
    //add a handler
    let dispose = events.on("foo", ()=>{});
     
    //fire off an event
    events.emit("foo", "bar");
     
    //remove the handler
    dispose();

    once

    import {LiteEventEmitter} from 'lite-event-emitter'
     
    let events = new LiteEventEmitter();
     
    events.once("foo", ()=>{});
    events.emit("foo", "bar"); // subscription auto-disposed

    Credits

    "Flask" Icon courtesy of The Noun Project, by Julien Deveaux, under CC 3.0

    Install

    npm i lite-event-emitter

    DownloadsWeekly Downloads

    1

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • meirionhughes