New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

event-station

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

event-station

A versatile and robust event emitter class.

  • 1.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
decreased by-42.11%
Maintainers
1
Weekly downloads
 
Created
Source

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

  • Versatile API that's flexible and consistent
  • Cross-emitter listening, allowing for easier management of many listeners
  • Regular expression listeners
  • Asynchronous Listeners with emitAsync()
  • Listener modifiers; a fluent interface for modifying listeners
    • Set callbacks and contexts with calling() and using()
    • Migration via moveTo(), addTo(), and removeFrom()
    • Remove listeners from all emitters with off()
    • Limit occurrences with occur()
    • pause(), resume(), and isPaused()
    • Create evented race() and all() promises
    • Duplication with clone()
  • Browser environment compatible
  • Competitive and consistent performance
  • Rx compatible with toObservable()
  • Helpers like stopPropagation() and listenerCount
  • extend() any object
  • Global and per-instance config() options
  • Over 200 tests with 100% code coverage
  • Written in TypeScript

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.

Keywords

FAQs

Package last updated on 17 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc