Skip to content

deno-library/events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

EventEmitter

EventEmitter for deno, API is the same as Nodejs, Have all the APIs of nodejs

Refer to nodejs events documentation

Useage

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");