1.0.7 • Published 5 years ago
@evodev/eventemitter v1.0.7
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
eventas name. It will return an ID as identity.EventEmitter#emit(event)To emit functions those have
eventas name.EventEmitter#off(id)To delete a function that have
idas ID.EventEmitter#get(name)To get an event data with
nameas 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")); //falseSupport
Developer
- Gaia#7541 (Discord)
Donation
- PayPal: nekomaru76