README
Heehaw
Heehaw is a tiny event emitter based on the Node.js EventEmitter but not feature complete.
Deno import
- latest -
import { EventEmitter } from "https://gitlab.com/rhythnic/heehaw/-/raw/master/src/mod.ts"
- versioned -
import { EventEmitter } from "https://gitlab.com/rhythnic/heehaw/-/raw/VERSION/src/mod.ts"
NPM install
npm install heehaw
Usage
import { EventEmitter } from 'heehaw'
const events = new EventEmitter()
function handler (...args) {
console.log(args.join(' '))
}
events.on('hello', handler)
events.emit('hello', 'Hello', 'World')
events.off('hello', handler)
// remove all listeners
events.listeners('hello').forEach(x => events.off('hello', x))
API
on(topic, handler)
once(topic, handler)
off(topic, handler)
emit(topic[, ...args])
- topic String
listeners(topic)
LICENSE
MIT license, Copyright Nicholas Baroni 2020