We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3ad8799 commit dd93730Copy full SHA for dd93730
doc/api/process.md
@@ -36,6 +36,23 @@ termination, such as calling [`process.exit()`][] or uncaught exceptions.
36
The `'beforeExit'` should *not* be used as an alternative to the `'exit'` event
37
unless the intention is to schedule additional work.
38
39
+```js
40
+process.on('beforeExit', (code) => {
41
+ console.log('Process beforeExit event with code: ', code);
42
+});
43
+
44
+process.on('exit', (code) => {
45
+ console.log('Process exit event with code: ', code);
46
47
48
+console.log('This message is displayed first.');
49
50
+// Prints:
51
+// This message is displayed first.
52
+// Process beforeExit event with code: 0
53
+// Process exit event with code: 0
54
+```
55
56
### Event: 'disconnect'
57
<!-- YAML
58
added: v0.7.7
0 commit comments