@evodev/eventemitter

1.0.7 • Public • Published

EventEmitter

is an object/method which triggers an event as soon as some action takes place so as to pass the cntrol to the parent function.

Usage

  • EventEmitter#on(event, callback)

To add new callback function with event as name. It will return an ID as identity.

  • EventEmitter#emit(event)

To emit functions those have event as name.

  • EventEmitter#off(id)

To delete a function that have id as ID.

  • EventEmitter#get(name)

To get an event data with name as name.

Example

const EE = require("@evodev/eventemitter");
const ee = new EE();

let ids = [];

ids.push(ee.once("lol", () => 10*1));

console.log(ee.emit("lol")); //["lol"]
console.log(ee.emit("lol")); //false

Support

Developer

  • Gaia#7541 (Discord)

Donation

  • PayPal: nekomaru76

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @evodev/eventemitter

    Weekly Downloads

    0

    Version

    1.0.7

    License

    ISC

    Unpacked Size

    3.7 kB

    Total Files

    7

    Last publish

    Collaborators

    • nekomaru76
    • akuankka128