Comparing version 3.1.3 to 3.1.4
@@ -59,3 +59,3 @@ /** | ||
// Removing an exit hook: | ||
const unsubscribe = asyncExitHook(() => {}, {}); | ||
const unsubscribe = asyncExitHook(() => {}, {minimumWait: 500}); | ||
@@ -81,3 +81,5 @@ unsubscribe(); | ||
console.log('Exiting'); | ||
}, 500); | ||
}, { | ||
minimumWait: 500 | ||
}); | ||
@@ -84,0 +86,0 @@ // Instead of `process.exit()` |
{ | ||
"name": "exit-hook", | ||
"version": "3.1.3", | ||
"version": "3.1.4", | ||
"description": "Run some code when the process exits", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -55,7 +55,7 @@ # exit-hook | ||
Type: `function(): void` | ||
Type: `() => void` | ||
The callback function to execute when the process exits. | ||
### asyncExitHook(onExit, minimumWait) | ||
### asyncExitHook(onExit, options) | ||
@@ -68,2 +68,18 @@ Register a function to run during `gracefulExit`. | ||
#### onExit | ||
Type: `() => (void | Promise<void>)` | ||
The callback function to execute when the process exits via `gracefulExit`, and will be wrapped in `Promise.resolve`. | ||
#### options | ||
Type: `object` | ||
##### minimumWait | ||
Type: `number` | ||
The amount of time in milliseconds that the `onExit` function is expected to take. | ||
```js | ||
@@ -74,3 +90,5 @@ import {asyncExitHook} from 'exit-hook'; | ||
console.log('Exiting'); | ||
}, 300); | ||
}, { | ||
minimumWait: 300 | ||
}); | ||
@@ -96,16 +114,2 @@ throw new Error('🦄'); | ||
#### onExit | ||
Type: `function(): void | Promise<void>` | ||
The callback function to execute when the process exits via `gracefulExit`, and will be wrapped in `Promise.resolve`. | ||
#### options | ||
##### minimumWait | ||
Type: `number` | ||
The amount of time in milliseconds that the `onExit` function is expected to take. | ||
### gracefulExit(signal?: number): void | ||
@@ -112,0 +116,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10986
176
139