mirror of
https://github.com/JonasunderscoreJones/api.jonasjones.dev.git
synced 2025-10-23 12:09:19 +02:00
Initial commit (by create-cloudflare CLI)
This commit is contained in:
commit
58a42872a0
1745 changed files with 741893 additions and 0 deletions
67
node_modules/exit-hook/readme.md
generated
vendored
Normal file
67
node_modules/exit-hook/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
# exit-hook
|
||||
|
||||
> Run some code when the process exits
|
||||
|
||||
The `process.on('exit')` event doesn't catch all the ways a process can exit.
|
||||
|
||||
This package is useful for cleaning up before exiting.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install exit-hook
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const exitHook = require('exit-hook');
|
||||
|
||||
exitHook(() => {
|
||||
console.log('Exiting');
|
||||
});
|
||||
|
||||
// You can add multiple hooks, even across files
|
||||
exitHook(() => {
|
||||
console.log('Exiting 2');
|
||||
});
|
||||
|
||||
throw new Error('🦄');
|
||||
|
||||
//=> 'Exiting'
|
||||
//=> 'Exiting 2'
|
||||
```
|
||||
|
||||
Removing an exit hook:
|
||||
|
||||
```js
|
||||
const exitHook = require('exit-hook');
|
||||
|
||||
const unsubscribe = exitHook(() => {});
|
||||
|
||||
unsubscribe();
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### exitHook(callback)
|
||||
|
||||
Returns a function that removes the hook when called.
|
||||
|
||||
#### callback
|
||||
|
||||
Type: `Function`
|
||||
|
||||
The callback to execute when the process exits.
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-exit-hook?utm_source=npm-exit-hook&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue