@@ -45,6 +45,8 @@ the IPC channel is closed.
4545added: v0.1.7
4646-->
4747
48+ * ` code ` {integer}
49+
4850The ` 'exit' ` event is emitted when the Node.js process is about to exit as a
4951result of either:
5052
@@ -56,7 +58,7 @@ all `'exit'` listeners have finished running the Node.js process will terminate.
5658
5759The listener callback function is invoked with the exit code specified either
5860by the [ ` process.exitCode ` ] [ ] property, or the ` exitCode ` argument passed to the
59- [ ` process.exit() ` ] method, as the only argument .
61+ [ ` process.exit() ` ] method.
6062
6163``` js
6264process .on (' exit' , (code ) => {
@@ -82,16 +84,15 @@ process.on('exit', (code) => {
8284added: v0.5.10
8385-->
8486
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+
8591If the Node.js process is spawned with an IPC channel (see the [ Child Process] [ ]
8692and [ Cluster] [ ] documentation), the ` 'message' ` event is emitted whenever a
8793message sent by a parent process using [ ` childprocess.send() ` ] [ ] is received by
8894the child process.
8995
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-
9596The message goes through serialization and parsing. The resulting message might
9697not be the same as what is originally sent.
9798
@@ -100,13 +101,12 @@ not be the same as what is originally sent.
100101added: v1.4.1
101102-->
102103
104+ * ` promise ` {Promise} The late handled promise.
105+
103106The ` 'rejectionHandled' ` event is emitted whenever a ` Promise ` has been rejected
104107and an error handler was attached to it (using [ ` promise.catch() ` ] [ ] , for
105108example) later than one turn of the Node.js event loop.
106109
107- The listener callback is invoked with a reference to the rejected ` Promise ` as
108- the only argument.
109-
110110The ` Promise ` object would have previously been emitted in an
111111` 'unhandledRejection' ` event, but during the course of processing gained a
112112rejection handler.
@@ -129,11 +129,11 @@ when the list of unhandled rejections shrinks.
129129
130130``` js
131131const 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);
134134});
135- process .on (' rejectionHandled' , (p ) => {
136- unhandledRejections .delete (p );
135+ process .on (' rejectionHandled' , (promise ) => {
136+ unhandledRejections .delete (promise );
137137});
138138```
139139
@@ -261,6 +261,12 @@ being emitted. Alternatively, the [`'rejectionHandled'`][] event may be used.
261261added: v6.0.0
262262-->
263263
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+
264270The ` 'warning' ` event is emitted whenever Node.js emits a process warning.
265271
266272A 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.
269275Node.js can emit warnings whenever it detects bad coding practices that could
270276lead to sub-optimal application performance, bugs, or security vulnerabilities.
271277
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-
280278``` js
281279process .on (' warning' , (warning ) => {
282280 console .warn (warning .name ); // Print the warning name
0 commit comments