JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4942906
  • Score
    100M100P100Q210310F
  • License MIT

Run some code when the process exits

Package Exports

  • exit-hook

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (exit-hook) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

exit-hook Build Status

Run some code when the process exits

The process.on('exit') event doesn't catch all the ways a process can exit.

Useful for cleaning up.

Install

$ npm install --save exit-hook

Usage

var exitHook = require('exit-hook');

exitHook(function () {
    console.log('exiting');
});

// you can add multiple hooks, even across files
exitHook(function () {
    console.log('exiting 2');
});

throw new Error('unicorns');

//=> exiting
//=> exiting 2

License

MIT © Sindre Sorhus