Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5542a98

Browse filesBrowse files
BridgeARMylesBorins
authored andcommitted
doc: improve process event headers
The headers should be handled as all others as well and just indicate all arguments. PR-URL: #20312 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent 90026c3 commit 5542a98
Copy full SHA for 5542a98

File tree

Expand file treeCollapse file tree

2 files changed

+20
-22
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-22
lines changed
Open diff view settings
Collapse file

‎doc/api/net.md‎

Copy file name to clipboardExpand all lines: doc/api/net.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ added: v0.3.4
388388
Creates a new socket object.
389389

390390
* `options` {Object} Available options are:
391-
* `fd`: {number} If specified, wrap around an existing socket with
391+
* `fd` {number} If specified, wrap around an existing socket with
392392
the given file descriptor, otherwise a new socket will be created.
393393
* `allowHalfOpen` {boolean} Indicates whether half-opened TCP connections
394394
are allowed. See [`net.createServer()`][] and the [`'end'`][] event
Collapse file

‎doc/api/process.md‎

Copy file name to clipboardExpand all lines: doc/api/process.md
+19-21Lines changed: 19 additions & 21 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ the IPC channel is closed.
4545
added: v0.1.7
4646
-->
4747

48+
* `code` {integer}
49+
4850
The `'exit'` event is emitted when the Node.js process is about to exit as a
4951
result of either:
5052

@@ -56,7 +58,7 @@ all `'exit'` listeners have finished running the Node.js process will terminate.
5658

5759
The listener callback function is invoked with the exit code specified either
5860
by 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
6264
process.on('exit', (code) => {
@@ -82,16 +84,15 @@ process.on('exit', (code) => {
8284
added: 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+
8591
If the Node.js process is spawned with an IPC channel (see the [Child Process][]
8692
and [Cluster][] documentation), the `'message'` event is emitted whenever a
8793
message sent by a parent process using [`childprocess.send()`][] is received by
8894
the 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-
9596
The message goes through serialization and parsing. The resulting message might
9697
not be the same as what is originally sent.
9798

@@ -100,13 +101,12 @@ not be the same as what is originally sent.
100101
added: v1.4.1
101102
-->
102103

104+
* `promise` {Promise} The late handled promise.
105+
103106
The `'rejectionHandled'` event is emitted whenever a `Promise` has been rejected
104107
and an error handler was attached to it (using [`promise.catch()`][], for
105108
example) 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-
110110
The `Promise` object would have previously been emitted in an
111111
`'unhandledRejection'` event, but during the course of processing gained a
112112
rejection handler.
@@ -129,11 +129,11 @@ when the list of unhandled rejections shrinks.
129129

130130
```js
131131
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);
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.
261261
added: 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+
264270
The `'warning'` event is emitted whenever Node.js emits a process warning.
265271

266272
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.
269275
Node.js can emit warnings whenever it detects bad coding practices that could
270276
lead 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
281279
process.on('warning', (warning) => {
282280
console.warn(warning.name); // Print the warning name

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.