import { EventEmitter } from "https://deno.land/x/net@v1.0.4/mod.ts";
Event Emitter is a simple event class with the sole purpose of being lightweight and easy to use. It only provides 4 basic methods.
Methods
emit(event: string, ...data: any[])
Sends a call to each function registered for the given event, passing all remaining parameters of this method to the function.
off(event: string, fn: (...args: any) => void)
Removes an event listener previously registered with EventEmitter.on (once is not removed) from the target.
on(event: string, fn: (...args: any) => void)
Sets up a function that will be called whenever the specified event is delivered to the target.
once(event: string, fn: (...args: any) => void)
Sets up a function that will be called only once when the specified event is delivered to the destination.