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.
flux-dispatcher
Advanced tools
A Flux dispatcher ready for action.
$ npm install flux-dispatcher
Note: Your project should have it's own flux
dependency installed. We depend
on flux
via peerDependencies
.
var myDispatcher = require('flux-dispatcher'); // that's us, such meta
var Constants = require('./Constants');
var ApiUtil = require('./ApiUtil');
var VIEW_ACTION = Constants.PayloadSources.VIEW_ACTION;
var SERVER_ACTION = Constants.PayloadSources.SERVER_ACTION;
var ActionTypes = Constants.ActionTypes;
var dispatch = myDispatcher.handleAction;
var Actions = {
sendRequest: function (data) {
dispatch(VIEW_ACTION, ActionTypes.SEND_REQUEST, data);
var request = {
method: 'POST',
url: '/api/endpoint',
data: data
};
ApiUtil(request, function (err, response) {
dispatch(SERVER_ACTION, ActionTypes.RECEIVE_RESPONSE, response);
});
}
};
module.exports = Actions;
handleAction(source, type, data)
This builds a payload and dispatches it. The payload will look like this:
{
source: source,
action: {
type: type,
data: data
}
}
handleAction(type, data)
If you don't pass a source
argument, the payload will look like this:
{
action: {
type: type,
data: data
}
}
MIT
What you create with flux-dispatcher
is more important than flux-dispatcher
.
FAQs
A Flux dispatcher ready for action.
We found that flux-dispatcher 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.