Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
sg-event-emitter
Advanced tools
Very simple class allowing for dispatch custom events in DOM-like style. It's tested in production apps on both browser and node.
All available methods are:
addEventListener(name: string, listener: ()=>void)
- adds a new listener to given eventremoveEventListener(name: string, listener: ()=>void)
- removes registered listener for given event. You have to pass exactly the same function as passed previously to addEventListener
.dispatchEvent(name: string)
- dispatches given eventsettle(host: any)
- links addEventListener
and removeEventListener
from EventEmitter instance to given host object. This allows you to create really encapsulated EventEmitter instance and expose only these two public methods.
var EventEmitter = require('sg-event-emitter').EventEmitter;
//or
import {EventEmitter} from 'sg-event-emitter';
class Foo {
constructor () {
this._eventEmitter = new EventEmitter();
this._eventEmitter.settle(this); //from now this object has
//`addEventListener` and `removeEventListener` methods
}
makeSomeAction () {
this._eventEmitter.dispatchEvent('myEvent');
}
}
var foo = new Foo();
var listener = _ => console.log('dispatched');
foo.addEventListener('myEvent', listener);
foo.makeSomeAction(); //logs 'dispatched'
foo.removeEventListener('myEvent', listener);
foo.makeSomeAction(); //doesn't log anything
FAQs
Simple service registry
The npm package sg-event-emitter receives a total of 223 weekly downloads. As such, sg-event-emitter popularity was classified as not popular.
We found that sg-event-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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.