0.1.0 • Published 5 years ago

heehaw v0.1.0

Weekly downloads
5
License
MIT
Repository
gitlab
Last release
5 years ago

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)

listeners(topic)

LICENSE

MIT license, Copyright Nicholas Baroni 2020

0.1.0

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago