EventEmitter for deno, API is the same as Nodejs, Have all the APIs of nodejs
Refer to nodejs events documentation
import EventEmitter from "https://deno.land/x/[email protected]/mod.ts";
const ee = new EventEmitter();
ee.on("message", msg => {
console.log(msg);
});
emitter.emit("message");
extends
import EventEmitter from "https://deno.land/x/[email protected]/mod.ts";
class A extends EventEmitter {}
const a = new A();
a.on("message", msg => {
console.log(msg);
});
a.emit("message");