@@ -45,6 +45,8 @@ the IPC channel is closed.
45
45
added: v0.1.7
46
46
-->
47
47
48
+ * ` code ` {integer}
49
+
48
50
The ` 'exit' ` event is emitted when the Node.js process is about to exit as a
49
51
result of either:
50
52
@@ -56,7 +58,7 @@ all `'exit'` listeners have finished running the Node.js process will terminate.
56
58
57
59
The listener callback function is invoked with the exit code specified either
58
60
by the [ ` process.exitCode ` ] [ ] property, or the ` exitCode ` argument passed to the
59
- [ ` process.exit() ` ] method, as the only argument .
61
+ [ ` process.exit() ` ] method.
60
62
61
63
``` js
62
64
process .on (' exit' , (code ) => {
@@ -82,16 +84,15 @@ process.on('exit', (code) => {
82
84
added: v0.5.10
83
85
-->
84
86
87
+ * ` message ` {Object} a parsed JSON object or primitive value.
88
+ * ` sendHandle ` {net.Server|net.Socket} a [ ` net.Server ` ] [ ] or [ ` net.Socket ` ] [ ]
89
+ object, or undefined.
90
+
85
91
If the Node.js process is spawned with an IPC channel (see the [ Child Process] [ ]
86
92
and [ Cluster] [ ] documentation), the ` 'message' ` event is emitted whenever a
87
93
message sent by a parent process using [ ` childprocess.send() ` ] [ ] is received by
88
94
the child process.
89
95
90
- The listener callback is invoked with the following arguments:
91
- * ` message ` {Object} a parsed JSON object or primitive value.
92
- * ` sendHandle ` {net.Server|net.Socket} a [ ` net.Server ` ] [ ] or [ ` net.Socket ` ] [ ]
93
- object, or undefined.
94
-
95
96
The message goes through serialization and parsing. The resulting message might
96
97
not be the same as what is originally sent.
97
98
@@ -100,13 +101,12 @@ not be the same as what is originally sent.
100
101
added: v1.4.1
101
102
-->
102
103
104
+ * ` promise ` {Promise} The late handled promise.
105
+
103
106
The ` 'rejectionHandled' ` event is emitted whenever a ` Promise ` has been rejected
104
107
and an error handler was attached to it (using [ ` promise.catch() ` ] [ ] , for
105
108
example) later than one turn of the Node.js event loop.
106
109
107
- The listener callback is invoked with a reference to the rejected ` Promise ` as
108
- the only argument.
109
-
110
110
The ` Promise ` object would have previously been emitted in an
111
111
` 'unhandledRejection' ` event, but during the course of processing gained a
112
112
rejection handler.
@@ -129,11 +129,11 @@ when the list of unhandled rejections shrinks.
129
129
130
130
``` js
131
131
const unhandledRejections = new Map ();
132
- process .on (' unhandledRejection' , (reason , p ) => {
133
- unhandledRejections .set (p , reason);
132
+ process .on (' unhandledRejection' , (reason , promise ) => {
133
+ unhandledRejections .set (promise , reason);
134
134
});
135
- process .on (' rejectionHandled' , (p ) => {
136
- unhandledRejections .delete (p );
135
+ process .on (' rejectionHandled' , (promise ) => {
136
+ unhandledRejections .delete (promise );
137
137
});
138
138
```
139
139
@@ -261,6 +261,12 @@ being emitted. Alternatively, the [`'rejectionHandled'`][] event may be used.
261
261
added: v6.0.0
262
262
-->
263
263
264
+ * ` warning ` {Error} Key properties of the warning are:
265
+ * ` name ` {string} The name of the warning. ** Default:** ` 'Warning' ` .
266
+ * ` message ` {string} A system-provided description of the warning.
267
+ * ` stack ` {string} A stack trace to the location in the code where the warning
268
+ was issued.
269
+
264
270
The ` 'warning' ` event is emitted whenever Node.js emits a process warning.
265
271
266
272
A process warning is similar to an error in that it describes exceptional
@@ -269,14 +275,6 @@ are not part of the normal Node.js and JavaScript error handling flow.
269
275
Node.js can emit warnings whenever it detects bad coding practices that could
270
276
lead to sub-optimal application performance, bugs, or security vulnerabilities.
271
277
272
- The listener function is called with a single ` warning ` argument whose value is
273
- an ` Error ` object. There are three key properties that describe the warning:
274
-
275
- * ` name ` {string} The name of the warning (currently ` 'Warning' ` by default).
276
- * ` message ` {string} A system-provided description of the warning.
277
- * ` stack ` {string} A stack trace to the location in the code where the warning
278
- was issued.
279
-
280
278
``` js
281
279
process .on (' warning' , (warning ) => {
282
280
console .warn (warning .name ); // Print the warning name
0 commit comments