Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Run a piece of code whenever the javascript-process stops/exits/quits. On browsers, nodejs, electron, react-native, .net-core. It also ensures that the exit-function is called only once.
You should use this module when your write a npm-library where you dont know in which environments the users will run it.
unload
handle?When nodejs:
process.on('beforeExit')
process.on('exit')
process.on('SIGINT')
process.on('uncaughtException')
When browser:
window.addEventListener('beforeunload')
When electron:
app.on('window-all-closed')
Installation:
npm install unload --save
Add a function which runs when the process exits:
var unload = require('unload');
unload.add(function(){
console.log('Ouch, I\'m dying.');
});
Add and remove the function (It will no longer run when the process exits):
var unload = require('unload');
var stopListen = unload.add(function(){
console.log('Ouch, I\'m dying.');
});
stopListen(); // removes the event-listeners
Run all previously added functions:
var unload = require('unload');
unload.add(function(){
console.log('Ouch, I\'m dying.');
});
unload.runAll();
Remove all added functions (They will no longer run when the process exits):
var unload = require('unload');
unload.add(function(){
console.log('Ouch, I\'m dying.');
});
unload.removeAll();
FAQs
Execute code when the js-process exits. On all javascript-environments
We found that unload 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.