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.
Listen to any event emitter with a single API.
.on
, .addEventListener
, .subscribe
, ... Why are there so many method names ?
hear is an "universal binder" that allows you to use one method name with the different event emitters, whether it is a DOM node, Node EventEmitter, mediator...
You can also pass a context and hear will handle this for you (no bind
leak).
on
/off
methods. See events.js for API support list.npm i --save hearjs
var hear = require('hearjs');
var emitter = new EventEmitter();
var mediator = new Mediator();
function MyType() {
hear($node, 'click', onEvent, this); // document.querySelector('.node');
hear(emitter, 'onClick', onEvent, this); // EventEmitter
hear(mediator, 'onClick', onEvent, this); // Mediator
}
MyType.prototype.onEvent = function() {
// ...
};
hear.on(emitter, eventName, fn, context)
listen eventName
on the emitter
.
hear.once(emitter, eventName, fn, context)
like .on
but is unbound after first call.
hear.off(emitter, eventName, fn, context)
Unbind an event listener.
If supported by the passed emitter
:
fn
is passed, all the eventName
listeners will be unboundeventName
is passed, the emitter
will be totally unboundCheckout from dev
, merge back against dev
.
Add relevant test cases.
4 spaces, semicolon.
off
method without event/fn argumentFAQs
Listen to any event emitter, with a single API.
The npm package hear receives a total of 1 weekly downloads. As such, hear popularity was classified as not popular.
We found that hear 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.