emanate

1.2.2 • Public • Published

Table of Contents

Emanate

Build Status npm version Coverage Status.

Event emitter for the browser.

Install

npm i emanate --save

EventEmitter

The event emitter class is the base class that provides event dispatching. It is designed to mimic the node event emitter.

Methods

emitter.addListener(event, listener)

Adds a listener to the end of the listeners array for the specified event.

Returns emitter, so calls can be chained.

Aliased via the on method.

emitter.removeListener(event, listener)

Remove a listener from the listener array for the specified event. Caution: changes array indices in the listener array behind the listener.

Returns emitter, so calls can be chained.

Aliased via the off method.

emitter.once(event, listener)

Adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed.

Returns emitter, so calls can be chained.

emitter.removeAllListeners([event])

Removes all listeners, or those of the specified event.

Returns emitter, so calls can be chained.

emitter.listeners(event)

Returns an array of listeners for the specified event.

emitter.emit(event, [arg1], [arg2], [...])

Execute each of the listeners in order with the supplied arguments.

Returns true if event had listeners, false otherwise.

Developer

Developer workflow is via gulp but should be executed as npm scripts to enable shell execution where necessary.

Test

Run the headless test suite using phantomjs:

npm test

To run the tests in a browser context open test/index.html or use the server npm start.

Start

Serve the test files from a web server with:

npm start

Cover

Run the test suite and generate code coverage:

npm run cover

Lint

Run the source tree through eslint:

npm run lint

Clean

Remove generated files:

npm run clean

Spec

Compile the test specifications:

npm run spec

Instrument

Generate instrumented code from lib in instrument:

npm run instrument

Readme

Generate the project readme file (requires mdp):

npm run readme

License

Everything is MIT. Read the license if you feel inclined.

Generated by mdp(1).

Readme

Keywords

none

Package Sidebar

Install

npm i emanate

Weekly Downloads

0

Version

1.2.2

License

MIT

Last publish

Collaborators

  • justsee
  • muji
  • tmpfs