npm i -S node-graceful
yarn add node-graceful
- Typescript rewrite
- BREAKING minimize API to the
exit
event only
- BREAKING remove support for callback in
exit
event
- NEW FEATURE allow handling uncaught exceptions
- NEW FEATURE allow capturing unhandled rejections
- update README to reflect the new API
- more rigid tests
- TS typing now derived from the code
- optimise published files
Migration to v3
- to wait for asynchronous callbacks use
Promise
constructor
Graceful.on('exit', (done, signal) => {
server.close(() => done());
});
// now becomes
Graceful.on('exit', (signal) => {
return new Promise((resolve) => {
server.close(() => resolve());
});
});
- If you were using
Graceful
to listen to terminating events you can replace them with direct listeners on process
.
Graceful.on('SIGTERM', listener)
//now becomes
process.on('SIGTERM', listener)`