--
This commit is contained in:
parent
24f3d27984
commit
6b60015c02
9588 changed files with 1149251 additions and 49 deletions
40
node_modules/exit-hook/readme.md
generated
vendored
Normal file
40
node_modules/exit-hook/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# exit-hook [](https://travis-ci.org/sindresorhus/exit-hook)
|
||||
|
||||
> 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
|
||||
|
||||
```sh
|
||||
$ npm install --save exit-hook
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
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](http://sindresorhus.com)
|
||||
Loading…
Reference in a new issue