Skip to content
Simple, fast, event emitter with a minimal but rich API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
test
.gitignore
.travis.yml
README.md
index.js
package-lock.json
package.json

README.md

Travis CI devDependency Status js-standard-style

On Emit

Simple, fast, event emitter with a minimal but rich API

  • Tiny
  • 100% test coverage
  • rich API
  • performant
  • zero dependencies

Installation

npm install on-emit

Usage

var create = require('on-emit')
var emitter = create()

var dispose = emitter.on('a', log)
emitter.emit('a', { data: true }) // logs

dispose() // removes specific listener
emitter.off() // removes all listeners
emitter.off('a') // removes all listeners for 'a' namespaced events
emitter.off('a', log) // removes all listeners for 'a' namespaced events with 'log' handler

emitter.on('*', log) // logs all events

function log (type, data) {
  console.log(type, data)
}
You can’t perform that action at this time.