source: trip-planner-front/node_modules/signal-exit/README.md@ b738035

Last change on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1# signal-exit
2
3[![Build Status](https://travis-ci.org/tapjs/signal-exit.png)](https://travis-ci.org/tapjs/signal-exit)
4[![Coverage](https://coveralls.io/repos/tapjs/signal-exit/badge.svg?branch=master)](https://coveralls.io/r/tapjs/signal-exit?branch=master)
5[![NPM version](https://img.shields.io/npm/v/signal-exit.svg)](https://www.npmjs.com/package/signal-exit)
6[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
7
8When you want to fire an event no matter how a process exits:
9
10* reaching the end of execution.
11* explicitly having `process.exit(code)` called.
12* having `process.kill(pid, sig)` called.
13* receiving a fatal signal from outside the process
14
15Use `signal-exit`.
16
17```js
18var onExit = require('signal-exit')
19
20onExit(function (code, signal) {
21 console.log('process exited!')
22})
23```
24
25## API
26
27`var remove = onExit(function (code, signal) {}, options)`
28
29The return value of the function is a function that will remove the
30handler.
31
32Note that the function *only* fires for signals if the signal would
33cause the process to exit. That is, there are no other listeners, and
34it is a fatal signal.
35
36## Options
37
38* `alwaysLast`: Run this handler after any other signal or exit
39 handlers. This causes `process.emit` to be monkeypatched.
Note: See TracBrowser for help on using the repository browser.