Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
connect-debounce
Advanced tools
Distributed debounced function execution ala underscore on per session basis as connect middleware.
If user interaction is followed by a request to the server and has heavy task to do, you might want to prevent the user from triggering this multiple times. It is not always possible to solve this on the client, because:
Module will save the date of the last attempt to execute the function into the session store of connect. On every attempt to execute it again, it will check the date and prevent execution more often than the wait
time defined for the function.
Debounce returns a middlware function. You can pass new wait
option, default is 1000ms.
Example:
var debounce = require('connect-debounce');
var app = connect();
app
.use(debounce({wait: 3000}))
.use(connect.logger('dev'))
.use(connect.static('public'))
.use(function(req, res){
res.end('hello world\n');
})
.listen(3000);
fn
is a function which execution will be debounced. It can get an error object passed as first argument. Don't ignore it! Better to use a function name to avoid potential conflicts with some other debounced function which has the same implementation.wait
time in ms to wait, default is the value described in setup.immediate
exec function immediately and debounce it laterExample:
app.get('/', function(req, res, next) {
req.debounce(function(err) {
if (err) {
// Request is already responded, log the error.
return log(err);
}
doSomething();
}, 3000);
res.send('my response');
});
npm i connect-debounce
npm test
FAQs
Distributed debounced function execution ala underscore on per session basis as connect middleware.
The npm package connect-debounce receives a total of 2 weekly downloads. As such, connect-debounce popularity was classified as not popular.
We found that connect-debounce 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.