Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
accu-mediator
Advanced tools
Mediator (pub/sub) implemented on top of accu-router.
npm install accu-mediator --save
Instantiate the mediator:
var Mediator = require( 'accu-mediator' );
var mediator = new Mediator();
//or use the default instance
var mediator = require( 'accu-mediator' ).instance;
//or
var mediator = require( 'accu-mediator' ).create();
Subscribe to topics
//topics are route paths, see accu-router for route examples
mediator.subscribe( 'my/topic/with/:tokens', myCallbackFn );
//add a receiver context for your callback
mediator.subscribe( 'my/topic/without/tokens', myObj.method, myObj );
The callback will be invoked in the context of the receiver with arguments
of [topic, ...arg]
. This is how your callback knows which event triggered
it when a token or wildcard was used to register it.
Publish topics. Data arguments are optional.
mediator.publish( 'my/topic' );
The publish method returns false
if no callbacks were registered or a Promise
for the resolution of all callbacks. The Promise
will resolve to an array of
all callback values.
mediator.publish( 'call/server' ).then( doSomething );
Remove all callbacks subscribed with the same parameters.
mediator.unsubscribe( 'my/topic', myCallback );
mediator.unsubscribe( 'my/topic', myObj.method, myObj );
FAQs
A mediator built on accu-router
The npm package accu-mediator receives a total of 0 weekly downloads. As such, accu-mediator popularity was classified as not popular.
We found that accu-mediator 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.