1.1.0 • Published 7 years ago

checked-emitter v1.1.0

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

checked-emitter

An EventEmitter implementation that wraps fbemitter with checks to ensure that event types are always registered before use.

Usage

var CheckedEmitter = require('checked-emitter');
var e = new CheckedEmitter();

e.registerEvent('propchange', 'propName', 'oldValue', 'newValue');
e.addListener('propchange', function(name, oldValue, newValue) {
  ...
});
e.emit('propchange', 'count', 3, 4);

API

The API is the same as fbemitter.EventEmitter, with the following additions:

registerEvent(eventType, ...params)

Register a new event to be emitted. eventType is a String, params are parameter names for the event.

registerEvents(obj)

Shorthand for registering multiple events. obj is a mapping {String : Array} of event types to parameter names.

events()

Return an Array of objects representing the events that have been registered on this emitter.

1.1.0

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago