Security News
Supply Chain Attack Detected in @solana/web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
#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 6,358 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.