announcement
Asynchronous event emitter and aggregator.
Install
Install with npm
npm i announcement --save
Run tests
npm test
Usage
var Announcement = require('announcement');
API
Main entry point of Announcement event emitter/aggregator
var Announcement = require('announcement');
var announcement = new Announcment();
Register a listener for an event.
event
{String|Function}: Event type to listen for.cb
{Function}: Callback invoked when event
type is emitted.returns
{Function}: Original callback function or handler function to use to remove listener.
announcement.on('foo', function (data) {
});
var FooEvent = function () {};
announcement.on(FooEvent, function (data) {
});
Asynchronously emit an event and additional data.
event
{String|Object}: Event type to emit.
announcement.emit('foo', { bar: 'baz' });
var foo = new FooEvent();
foo.bar = 'baz';
announcement.emit(foo);
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Brian Woodward
License
Copyright (c) 2015 Brian Woodward
Released under the MIT license
This file was generated by verb on January 27, 2015.