node-graceful
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -54,2 +54,4 @@ // +----------------------------------------------------------------------+ | ||
Graceful.off = function (signal, listener) { | ||
if (signal !== 'exit') | ||
throw new Error('Only supports \'exit\' signal'); | ||
var index = Graceful.listeners.indexOf(listener); | ||
@@ -56,0 +58,0 @@ if (index !== -1) |
@@ -68,2 +68,4 @@ // +----------------------------------------------------------------------+ | ||
public static off(signal: 'exit', listener: GracefulListener) { | ||
if (signal !== 'exit') throw new Error('Only supports \'exit\' signal'); | ||
const index = Graceful.listeners.indexOf(listener); | ||
@@ -70,0 +72,0 @@ if (index !== -1) Graceful.listeners.splice(index, 1); |
{ | ||
"name": "node-graceful", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Graceful process exit manager. allows waiting on multiple async services.", | ||
@@ -32,3 +32,3 @@ "main": "index.js", | ||
"build": "tsc --build tsconfig.json", | ||
"prepublishOnly": "npm run test && npm run build" | ||
"prepublishOnly": "npm run build && npm run test" | ||
}, | ||
@@ -44,7 +44,7 @@ "files": [ | ||
"devDependencies": { | ||
"@types/node": "8.10.48", | ||
"ts-node": "^8.5.2", | ||
"tslint": "^5.20.1", | ||
"typescript": "^3.7.2" | ||
"@types/node": "^12.12.30", | ||
"ts-node": "^8.7.0", | ||
"tslint": "^6.1.0", | ||
"typescript": "^3.8.3" | ||
} | ||
} |
@@ -19,2 +19,13 @@ # node-graceful | ||
Typescript | ||
```typescript | ||
import Graceful from 'node-graceful'; | ||
Graceful.captureExceptions = true; | ||
Graceful.on('exit', async () => { | ||
await server.close(); | ||
}); | ||
``` | ||
Plain JS | ||
```javascript | ||
@@ -38,12 +49,2 @@ const Graceful = require('node-graceful'); | ||
Typescript | ||
```typescript | ||
import Graceful from 'node-graceful'; | ||
Graceful.captureExceptions = true; | ||
Graceful.on('exit', async () => { | ||
await server.close(); | ||
}); | ||
``` | ||
## Quick Docs | ||
@@ -110,3 +111,3 @@ | ||
if old style callback is needed, wrap the logic with a promise | ||
``` | ||
```javascript | ||
const server = require('http').createServer(function (req, res) { | ||
@@ -113,0 +114,0 @@ res.write('ok'); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
23476
331
247
0