easyemit
v0.1.0
Published
An easy-to-use event emitter for Deno & Node.js
Downloads
2
Maintainers
Readme
EasyEmit - A Tri Platform Event Emitter
EasyEmit is an event emitter for Deno, Node.js, and the web.
Installation
You can install EasyEmit for Node.js, Deno, or directly into a web page via a script
tag.
Node.js
# npm
npm install easyemit
# yarn
yarn add easyemit
Deno
import EventEmitter from 'https://deno.land/x/[email protected]/index.min.js'
Include Via CDN
<script src="https://unpkg.com/[email protected]/index.min.js" />
Usage
let emitter = new EventEmitter()
emitter.on('hello', (data) => {
console.log(`Hello ${data ?? 'world'}`)
})
emitter.emit('hello')
emitter.emit('hello', 'emitter')