Skip to content

v3.0.0

Compare
Choose a tag to compare
@mrbar42 mrbar42 released this 25 Nov 15:18
· 23 commits to master since this release
e7733d4
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

  1. 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());
  });
});
  1. 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)`