🚝 A versatile and robust event emitter class.
Switch branches/tags
greenkeeper/mocha-4.1.0 greenkeeper/mocha-5.0.0 greenkeeper/mocha-5.0.1 greenkeeper/mocha-5.0.2 greenkeeper/mocha-5.0.3 greenkeeper/mocha-5.0.4 greenkeeper/mocha-5.0.5 greenkeeper/mocha-5.1.0 greenkeeper/mocha-5.1.1 greenkeeper/mocha-5.2.0 greenkeeper/nyc-12.0.1 greenkeeper/nyc-12.0.2 greenkeeper/rollup-0.51.1 greenkeeper/rollup-0.51.2 greenkeeper/rollup-0.51.3 greenkeeper/rollup-0.51.4 greenkeeper/rollup-0.51.5 greenkeeper/rollup-0.51.6 greenkeeper/rollup-0.51.7 greenkeeper/rollup-0.51.8 greenkeeper/rollup-0.52.0 greenkeeper/rollup-0.52.1 greenkeeper/rollup-0.52.2 greenkeeper/rollup-0.52.3 greenkeeper/rollup-0.53.0 greenkeeper/rollup-0.53.1 greenkeeper/rollup-0.53.2 greenkeeper/rollup-0.53.3 greenkeeper/rollup-0.53.4 greenkeeper/rollup-0.54.0 greenkeeper/rollup-0.54.1 greenkeeper/rollup-0.55.0 greenkeeper/rollup-0.55.1 greenkeeper/rollup-0.55.2 greenkeeper/rollup-0.55.3 greenkeeper/rollup-0.55.4 greenkeeper/rollup-0.55.5 greenkeeper/rollup-0.56.0 greenkeeper/rollup-0.56.1 greenkeeper/rollup-0.56.2 greenkeeper/rollup-0.56.3 greenkeeper/rollup-0.56.4 greenkeeper/rollup-0.56.5 greenkeeper/rollup-0.57.0 greenkeeper/rollup-0.57.1 greenkeeper/rollup-0.58.0 greenkeeper/rollup-0.58.1 greenkeeper/rollup-0.58.2 greenkeeper/rollup-0.59.0 greenkeeper/rollup-0.59.1 greenkeeper/rollup-0.59.2 greenkeeper/rollup-0.59.3 greenkeeper/rollup-0.59.4 greenkeeper/rollup-0.60.0 greenkeeper/rollup-0.60.1 greenkeeper/rollup-0.60.2 greenkeeper/rollup-0.60.3 greenkeeper/rollup-0.60.4 greenkeeper/rollup-0.60.5 greenkeeper/rollup-0.60.6 greenkeeper/rollup-0.60.7 greenkeeper/rollup-0.61.0 greenkeeper/rollup-0.61.1 greenkeeper/rollup-0.61.2 greenkeeper/ts-node-4.0.0 greenkeeper/ts-node-4.0.1 greenkeeper/ts-node-4.0.2 greenkeeper/ts-node-4.1.0 greenkeeper/ts-node-5.0.0 greenkeeper/ts-node-5.0.1 greenkeeper/ts-node-6.0.0 greenkeeper/ts-node-6.0.2 greenkeeper/ts-node-6.0.3 greenkeeper/ts-node-6.0.4 greenkeeper/ts-node-6.0.5 greenkeeper/ts-node-6.1.0 greenkeeper/ts-node-6.1.1 greenkeeper/ts-node-6.1.2 greenkeeper/ts-node-6.2.0 greenkeeper/@types/node-9.3.0 greenkeeper/@types/node-9.4.0 greenkeeper/@types/node-9.4.1 greenkeeper/@types/node-9.4.2 greenkeeper/@types/node-9.4.3 greenkeeper/@types/node-9.4.4 greenkeeper/@types/node-9.4.5 greenkeeper/@types/node-9.4.6 greenkeeper/@types/node-9.4.7 greenkeeper/@types/node-9.6.0 greenkeeper/@types/node-9.6.1 greenkeeper/@types/node-9.6.2 greenkeeper/@types/node-9.6.3 greenkeeper/@types/node-9.6.4 greenkeeper/@types/node-9.6.5 greenkeeper/@types/node-9.6.6 greenkeeper/@types/node-10.0.3 greenkeeper/@types/node-10.0.7 greenkeeper/@types/node-10.0.9 greenkeeper/@types/node-10.0.10 greenkeeper/@types/node-10.1.0 greenkeeper/@types/node-10.1.1 greenkeeper/@types/node-10.1.2 greenkeeper/@types/node-10.1.3 greenkeeper/@types/node-10.1.4 greenkeeper/@types/node-10.3.0 greenkeeper/@types/node-10.3.1 greenkeeper/@types/node-10.3.2 greenkeeper/@types/node-10.3.3 greenkeeper/@types/node-10.3.4 greenkeeper/@types/node-10.3.6 greenkeeper/update-to-node-10 master
Nothing to show
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.
.vscode
benchmarks
config
dist
docs
scripts
src
tests
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
bower.json
jsconfig.json
package-lock.json
package.json
tsconfig.json

README.md

Event-Station

A versatile and robust event emitter class.

npm Version Bower Version MIT License Travis CI Build Status Codecov Coverage Status Dependencies Status DevDependencies Status

Features

Example

import EventStation from 'event-station';

class Spaceship extends EventStation {
    launch(destination) {
        this.emit('launch', destination);
    }
}

let Normandy = new Spaceship();
let Tempest = new Spaceship();

// Add two listeners via a listener map
let listeners = Normandy.on({
    launch: (dest) => console.log(`Spaceship launched! En route to ${dest}.`),
    dock: () => console.log('Spaceship docking.'),
});

// Attach the same listeners to Tempest that are on Normandy
listeners.addTo(Tempest);

// Launch Tempest when Normandy launches
Tempest.hear(Normandy, 'launch')
    .once((dest) => Tempest.launch(dest));

// Launch both ships to the Andromeda Galaxy
Normandy.launch('Messier 31');

// Stop listening to both ships
listeners.off();

View more usage examples.

Installation

Node.js via Yarn

yarn add event-station

Node.js via npm

npm install event-station --save

SystemJS via jspm

jspm install npm:event-station

Web browser via Bower

bower install event-station

Web browser via <script>

<script src="dist/event-station.min.js"></script>
<script>new EventStation();</script>

Downloads

Latest Release

Documentation

License

Copyright © 2016 Morris Allison III.
Released under the MIT license.

References

Event-Station was influenced by EventEmitter2 and Backbone.Events.