1.1.4 • Published 7 years ago

event-station v1.1.4

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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.

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.1.0-beta.3

7 years ago

1.1.0-beta

7 years ago

1.0.0

8 years ago

1.0.0-beta

9 years ago

0.5.2

9 years ago

0.5.1

9 years ago

0.5.0

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.0

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago