
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
event-listener-service
Advanced tools
Universal Event Litener with testability built in
Declare usage without internal event registering implementation
Set internal event registering implementation
Add EventListener
Emit event using built in event emiting
Remove EventListener
import EventListenerService from 'event-listener-service';
// Declare usage without internal event registering implementation
EventListenerService.useWithoutImplementation();
function onSomeEvent(event) {
console.log('some-event', event);
}
// Adding EventLisner
EventListenerService.addListener('some-event', onSomeEvent);
// Emiting Events
EventListenerService.emit('some-event', { rand: 9 });
// Removing EventLisnter
EventListenerService.removeListener('some-event', onSomeEvent);
import EventListenerService from 'event-listener-service';
// Seting internal event registering implementation
EventListenerService.setImplementation({
addListener: window.addEventListener.bind(window),
removeListener: window.removeEventListener.bind(window)
});
function onResize() {
/* ... */
}
// Adding EventLisner
EventListenerService.addListener('resize', onResize, false);
// Removing EventLisnter
EventListenerService.removeListener('resize', onResize, false);
// Optionaly you can manually trigger event listeners in your tests or when you need to fully simulate event
EventListenerService.emit('resize', /* [event object] */);
// Set internal implementation for registering event listeners
EventListenerService.setImplementation({
addListener: /* (eventName: string, listener: (event?: any) => void, ...additional: any[]) => void */
removeListener: /* (eventName: string, listener: (event?: any) => void, ...additional: any[]) => void */
});
// And than use addListener and removeListner
EventListnerService.addListener(eventName: string, listener: (event?: any) => void, ...additional: any[]);
EventListnerService.removeListener(eventName: string, listener: (event?: any) => void, ...additional: any[]);
npm install
npm run typings
npm test
npm install
npm run typings
Make changes
If necessary add some tests to __tests__
npm test
Make a Pull Request
FAQs
Universal Event Litener with testability built in
The npm package event-listener-service receives a total of 30 weekly downloads. As such, event-listener-service popularity was classified as not popular.
We found that event-listener-service 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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.