Skip to content

Latest commit

 

History

History
53 lines (32 loc) · 1.42 KB

README.md

File metadata and controls

53 lines (32 loc) · 1.42 KB

Loudspeaker

An event emitter whose purpose is to be as feature-rich as possible. This is meant to be more of an experiment of pushing the boundaries of what Event Emitters currently do. The mission is as max features, not min file size. Ease of use is also be a goal.

Getting Started

npm install --save loudspeaker

Version 1.0.0

This first version is simply an event emitter. It does what it's supposed to do. It's the first step. Help getting that second step would be appreciated!

Future Version Ideas

  • Adding tests of course
  • Common interface for cross browser events
  • Intercepting all events
  • Event statistics
  • All the stuff everyone else does
  • More...

Documentation

Loudspeaker#on

Loudspeaker.on(event:string, handler:function[, handerThis:object])

To start listening use this with an event name that you know will be emitted by Loudspeaker (currently dom events are not supported).

Handler

function ([...args]) {}

The handler will call with the emitted arguments applied.

Loudspeaker#off

Loudspeaker.off(event:string, handler:function||true:boolean)

To stop listening for a specific handler. Passing in true instead of a handler will remove all handlers from that event.

Loudspeaker#emit

Loudspeaker.emit(event:string, eventArguments:array)

Emits the event for all the handlers that might be listening, sent along with the arguments that should be included in the handler.