Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
channel-emitter
Advanced tools
npm i --save channel-emitter
/* a.js */
var channelEmitter = require('channel-emitter');
channelEmitter.on('foo', function () { console.log(arguments); });
/* b.js */
var channelEmitter = require('channel-emitter');
channelEmitter.emit('foo', true, {foo: []}, 123);
/* c.js */
require('./a');
require('./b');
// outputs: { '0': true, '1': { foo: [] }, '2': 123 }
/* a.js */
var channelEmitter = require('channel-emitter');
channelEmitter.on('foobar', function () { console.log('foobar: ', arguments); });
channelEmitter.on('foo.bar', function () { console.log('foo.bar: ', arguments); });
channelEmitter.emit('foobar', 'hi');
// returns true;
// outputs: foobar: { 0: 'hi' }
channelEmitter.emit('bar', 'hello');
// returns false;
// outputs:
channelEmitter.emit('foo.foobar', 'hi');
// returns true;
// outputs: foobar: { 0: 'hi' }
channelEmitter.emit('foo.bar', 'hello');
// returns true;
// outputs: foo.bar: { 0: 'hello' }
channelEmitter.broadcast('foobar', 'hi');
// returns true;
// outputs: foobar: { 0: 'hi' }
channelEmitter.broadcast('bar', 'hello');
// returns true;
// outputs: foo.bar: { 0: 'hello' }
channelEmitter.broadcast('foo.foobar', 'hi');
// returns false;
// outputs:
channelEmitter.broadcast('foo.bar', 'hello');
// returns true;
// outputs: foo.bar: { 0: 'hello' }
Example
var channel_emitter = require('channel-emitter');
ChannelEmitter
Wrapper for the EventEmitter.addListener
method that will auto-add channels
if the specified delimiter is used in the name.
Kind: inner method of channel-emitter
Param | Type | Description |
---|---|---|
eventName | string | the name for the event |
listener | function | the listener for the event |
ChannelEmitter
Wrapper for the EventEmitter.removeListener
method that will remove
events from a specified channl if the specified delimiter is used in the name.
Kind: inner method of channel-emitter
Param | Type | Description |
---|---|---|
eventName | string | the name for the event |
listener | function | the listener for the event |
ChannelEmitter
Wrapper for the EventEmitter.removeAllListeners
method that will remove
if the specified delimiter is used in the name.
Kind: inner method of channel-emitter
Param | Type | Description |
---|---|---|
[eventName] | string | the name for the event |
ChannelEmitter
Wrapper for the EventEmitter.listenerCount
method that will return the
listener count on a channel (including name-spaced events).
Kind: inner method of channel-emitter
Param | Type | Description |
---|---|---|
eventName | string | the name for the event |
ChannelEmitter
Wrapper for the EventEmitter.listeners
method that will return the
listeners on a channel (including name-spaced events).
Kind: inner method of channel-emitter
Param | Type | Description |
---|---|---|
eventName | string | the name for the event |
ChannelEmitter
Wrapper for the EventEmitter.on
method that will auto-add channels
if the specified delimiter is used in the name.
Kind: inner method of channel-emitter
Param | Type | Description |
---|---|---|
eventName | string | the name for the event |
listener | function | the listener for the event |
ChannelEmitter
Adds a sub-channel to the current channel.
Kind: inner method of channel-emitter
Param | Type | Description |
---|---|---|
channelName | string | the name for the channel |
ChannelEmitter
Removes the sub-channel from the current channel.
Kind: inner method of channel-emitter
Param | Type | Description |
---|---|---|
channelName | string | the name for the channel |
Boolean
EventEmitter wrapper that emits an event to siblings and direct ancestor channels.
Kind: inner method of channel-emitter
Param | Type | Description |
---|---|---|
eventName | string | the name for the registered event |
[...args] | * | arguments to emit to the event |
Boolean
Broadcasts an event to siblings and descendent channels.
Kind: inner method of channel-emitter
Param | Type | Description |
---|---|---|
eventName | string | the name for the registered event |
[...args] | * | arguments to broadcast to the event |
Apache 2.0
FAQs
An event emitter with channel and broadcast support
The npm package channel-emitter receives a total of 2 weekly downloads. As such, channel-emitter popularity was classified as not popular.
We found that channel-emitter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.