listenable is a super simple event emitter intended for the browser

npm install listenable
4 downloads in the last month


listenable is a super simple event emitter


npm install listenable


var listenable = new Listenable // new instance

// add event listener
listenable.on(eventName, fn)

// add event listener that only triggers once
listenable.once(eventName, fn)

// remove specific event listener (will remove all listeners that === fn), fn)

// remove all listeners for a name

// trigger an event (additional arguments are passed to the listeners)
listenable.emit(eventName[, args...])

// get listeners for an event
listenable.listeners.eventName // null or potentially empty Array of listeners


var Listenable = require('listenable')

var listenable = new Listenable

listenable.on('foo', function(arg) {
    console.log("foo "+arg+" just happened!")

listenable.emit('foo', 1)'foo')
listenable.emit('foo', 2)


listenable is open source software under the [zlib license][LICENSE].

npm loves you