Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
#kilt
Combines multiple event emitters into a single emitter.
Lead Maintainer - Emily Rose
Installation:
$ npm install --save kilt
Instantiate a kilt instance with the event emitters to combine and listen for
events on the new kilt instance. Kilt derives from EventEmitter
and may also
be used to emit events.
var Events = require('events');
var Kilt = require('kilt');
var emitter1 = new Events.EventEmitter();
var emitter2 = new Events.EventEmitter();
var kilt = new Kilt([emitter1, emitter2]);
// A single handler for both emitters.
kilt.on('hello', function (data) {
console.log(data);
});
// Emit events from multiple emitters.
emitter1.emit('hello', 'Hello from emitter1');
emitter2.emit('hello', 'Hello from emitter2');
// Emit a event using kilt.
kilt.emit('hello', 'Hello from Kilt');
Output:
Hello from emitter1
Hello from emitter2
Hello from kilt
Kilt([emitter(s)])
Kilt constructor which accepts optional emitters to manage.
var kilt = new Kilt();
... = new Kilt(emitter);
... = new Kilt([emitter]);
... = new Kilt([emitter1, emitter2]);
addEmitter(emitter)
Add an emitter for kilt to manage.
var emitter = new Events.Emitter();
kilt.addEmitter(emitter);
on(type, listener)
Attach a listener to all emitters with the specified type.
kilt.on('example', function (data) {
console.log(data);
});
once(type, listener)
Attach a listener to all emitters with the specified type that will only fire once.
kilt.once('example', console.log.bind(console, '"example" event emitted once with data:'));
removeListener(type, listener)
Remove the specified listener.
var emitter = new Events.Emitter();
var listener = function () {
return;
};
kilt.addEmitter(emitter);
// Attach listener.
kilt.on('example', listener);
// Remove listener.
kilt.removeListener('example', listener);
removeAllListeners([type])
Remove all listeners. Optionally, you may specify the type of listeners to remove.
// Attach listeners.
kilt.on('example', ...);
kilt.on('example', ...);
kilt.on('example', ...);
kilt.on('other', ...);
// Only remove listeners of a specific type.
kilt.removeAllListeners('example');
// Remove all listeners.
kilt.removeAllListeners();
emit(type[, data])
Emit the specified event with the specified, optional data.
var emitter = new Events.Emitter();
var kilt = new Kilt(emitter);
// Attach listener.
kilt.on('example', console.log.bind(console, '"example" event emitted with data:'));
// Emit event on kilt.
kilt.emit('example', 'emitted');
FAQs
Combines multiple event emitters into a single emitter
The npm package kilt receives a total of 4,196 weekly downloads. As such, kilt popularity was classified as popular.
We found that kilt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.