
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
redux-timer
Advanced tools
SetInterval middleware for Redux used to dispatch an action or function periodically.
npm install redux-timer
import { createStore, applyMiddleware } from 'redux';
import timerMiddleware from 'redux-timer';
const store = createStore(reducers, applyMiddleware(timerMiddleware));
To start a timer, you have to dispatch an action with type START_TIMER
with a payload of the following.
String
representing the name of the timer.String
matching an action type or a Function
that you would like to periodically execute.action
as an action typeimport { START_TIMER } from 'redux-timer';
export const startTimer = () => ({
type: START_TIMER,
payload: {
name: 'exampleTimer',
action: 'SOME_ACTION_TICK',
interval: 1000
}
});
action
as a Function
import { START_TIMER } from 'redux-timer';
export const exampleAction = () => async dispatch => {
dispatch({
type: START_TIMER,
payload: {
name: 'exampleTimer',
action: async () => {
try {
const response = await fetch('https://api.github.com');
const data = await response.json();
dispatch(setData(response.body.result));
} catch (e) {
// do something with this error
}
},
interval: 5000
}
});
};
To stop a timer, you have to dispatch an action with type STOP_TIMER
with a payload of the following.
String
representing the name of the timerimport { STOP_TIMER } from 'redux-timer';
export const stopTimer = () => ({
type: STOP_TIMER,
payload: {
name: 'exampleTimer'
}
});
FAQs
SetInterval middleware for Redux
The npm package redux-timer receives a total of 31 weekly downloads. As such, redux-timer popularity was classified as not popular.
We found that redux-timer 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.