Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
events-constructor
Advanced tools
Class for emitting events
npm
npm install events-constructor
yarn
yarn add events-constructor
import Events from 'events-constructor';
const eventNames = ['event1', 'event2'];
const events = new Events(initEventNames);
events.on('event1', data => {
console.log('event1 is called with data:', data);
});
events.trigger('event1', 'some data');
Add listener to event
events.on('event1', data => {
console.log('event1 is called with data:', data);
});
Add a listener that will be called only once per event
events.once('event1', data => {
console.log('event1 is called with data:', data);
});
Remove listener from event
events.off('event1', data => {
console.log('event1 is called with data:', data);
});
Trigger event with data
events.trigger('event1', 'some data');
Remove all listeners
events.removeEventHandlers();
Get all triggers
events.triggers;
Disable event handlers. The trigger method will not produce any effect.
events.on('event1', data => {
console.log('event1 is called with data:', data); //it's not called
});
events.deactivate();
events.trigger('event1', 'some data');
Enable event handlers.
events.on('event1', data => {
console.log('event1 is called with data:', data);
});
events.deactivate();
events.trigger('event1', 'some data'); // no effect
events.activate();
events.trigger('event1', 'some data'); // handler is called
Method for delegate triggers to otherEventsSource(for example)
events.eachTriggers((trigger, eventName) => otherEventsSource.on(eventName, trigger));
npm test
👤 Krivega Dmitriy
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
Copyright © 2020 Krivega Dmitriy.
This project is MIT licensed.
FAQs
Class for emitting events
We found that events-constructor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.