EasyEmit is an event emitter for Deno, Node.js, and the web.
You can install EasyEmit for Node.js, Deno, or directly into a web page via a script
tag.
# npm
npm install easyemit
# yarn
yarn add easyemit
import EventEmitter from 'https://deno.land/x/easyemit@0.1.0/index.min.js'
<script src="https://unpkg.com/easyemit@0.1.0/index.min.js" />
let emitter = new EventEmitter()
emitter.on('hello', (data) => {
console.log(`Hello ${data ?? 'world'}`)
})
emitter.emit('hello')
emitter.emit('hello', 'emitter')