New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

checked-emitter

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

checked-emitter

A wrapper for fbemitter that requires event types to be registered before use.

latest
Source
npmnpm
Version
1.1.0
Version published
Weekly downloads
39
143.75%
Maintainers
1
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 28 Feb 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