From 288052693925bc75c687245da1c3e6c20b1d50a7 Mon Sep 17 00:00:00 2001 From: "Kamat, Trivikram" <16024985+trivikr@users.noreply.github.com> Date: Fri, 23 Aug 2019 22:02:23 -0700 Subject: [PATCH 1/3] doc: add extends for derived classes --- doc/api/child_process.md | 5 +++-- doc/api/cluster.md | 2 ++ doc/api/dgram.md | 6 +++--- doc/api/domain.md | 5 +++-- doc/api/inspector.md | 4 ++-- doc/api/net.md | 4 ++++ doc/api/readline.md | 2 ++ doc/api/repl.md | 3 ++- doc/api/tty.md | 19 +++++++++++-------- 9 files changed, 32 insertions(+), 18 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 02ffce72388c04..332f38170be315 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -894,8 +894,9 @@ arbitrary command execution.** added: v2.2.0 --> -Instances of the `ChildProcess` class are [`EventEmitters`][`EventEmitter`] that -represent spawned child processes. +* Extends: {EventEmitter} + +Instances of the `ChildProcess` represent spawned child processes. Instances of `ChildProcess` are not intended to be created directly. Rather, use the [`child_process.spawn()`][], [`child_process.exec()`][], diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 8036f82e797617..fb7328aa4d730b 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -116,6 +116,8 @@ also be used for other use cases requiring worker processes. added: v0.7.0 --> +* Extends: {EventEmitter} + A `Worker` object contains all public information and method about a worker. In the master it can be obtained using `cluster.workers`. In a worker it can be obtained using `cluster.worker`. diff --git a/doc/api/dgram.md b/doc/api/dgram.md index d0af318117863a..c7915cfe7f72ce 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -35,8 +35,9 @@ server.bind(41234); added: v0.1.99 --> -The `dgram.Socket` object is an [`EventEmitter`][] that encapsulates the -datagram functionality. +* Extends: {EventEmitter} + +Encapsulates the datagram functionality. New instances of `dgram.Socket` are created using [`dgram.createSocket()`][]. The `new` keyword is not to be used to create `dgram.Socket` instances. @@ -719,7 +720,6 @@ and `udp6` sockets). The bound address and port can be retrieved using [`Error`]: errors.html#errors_class_error [`ERR_SOCKET_DGRAM_IS_CONNECTED`]: errors.html#errors_err_socket_dgram_is_connected [`ERR_SOCKET_DGRAM_NOT_CONNECTED`]: errors.html#errors_err_socket_dgram_not_connected -[`EventEmitter`]: events.html [`System Error`]: errors.html#errors_class_systemerror [`close()`]: #dgram_socket_close_callback [`cluster`]: cluster.html diff --git a/doc/api/domain.md b/doc/api/domain.md index 803fc2b830efd7..6d6c739e3dd2ad 100644 --- a/doc/api/domain.md +++ b/doc/api/domain.md @@ -273,11 +273,12 @@ serverDomain.run(() => { ## Class: Domain +* Extends: {EventEmitter} + The `Domain` class encapsulates the functionality of routing errors and uncaught exceptions to the active `Domain` object. -`Domain` is a child class of [`EventEmitter`][]. To handle the errors that it -catches, listen to its `'error'` event. +To handle the errors that it catches, listen to its `'error'` event. ### domain.members diff --git a/doc/api/inspector.md b/doc/api/inspector.md index f25d6209c12189..33f2384d265c1b 100644 --- a/doc/api/inspector.md +++ b/doc/api/inspector.md @@ -64,6 +64,8 @@ An exception will be thrown if there is no active inspector. ## Class: inspector.Session +* Extends: {EventEmitter} + The `inspector.Session` is used for dispatching messages to the V8 inspector back-end and receiving message responses and notifications. @@ -76,8 +78,6 @@ Create a new instance of the `inspector.Session` class. The inspector session needs to be connected through [`session.connect()`][] before the messages can be dispatched to the inspector backend. -`inspector.Session` is an [`EventEmitter`][] with the following events: - ### Event: 'inspectorNotification' +* Extends: {EventEmitter} + This class is used to create a TCP or [IPC][] server. ### new net.Server([options][, connectionListener]) @@ -384,6 +386,8 @@ active server in the event system. If the server is already `unref`ed calling added: v0.3.4 --> +* Extends: {stream.Duplex} + This class is an abstraction of a TCP socket or a streaming [IPC][] endpoint (uses named pipes on Windows, and Unix domain sockets otherwise). A `net.Socket` is also a [duplex stream][], so it can be both readable and diff --git a/doc/api/readline.md b/doc/api/readline.md index 43d3a7e8f62dd4..898d7e005fb652 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -38,6 +38,8 @@ received on the `input` stream. added: v0.1.104 --> +* Extends: {EventEmitter} + Instances of the `readline.Interface` class are constructed using the `readline.createInterface()` method. Every instance is associated with a single `input` [Readable][] stream and a single `output` [Writable][] stream. diff --git a/doc/api/repl.md b/doc/api/repl.md index 193e82240b7cbe..481d037c2337cb 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -333,7 +333,8 @@ function myWriter(output) { added: v0.1.91 --> -The `repl.REPLServer` class inherits from the [`readline.Interface`][] class. +* Extends: {readline.Interface} + Instances of `repl.REPLServer` are created using the `repl.start()` method and *should not* be created directly using the JavaScript `new` keyword. diff --git a/doc/api/tty.md b/doc/api/tty.md index 335aef7589b3bb..29d21440895b0d 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -35,10 +35,11 @@ classes. added: v0.5.8 --> -The `tty.ReadStream` class is a subclass of [`net.Socket`][] that represents the -readable side of a TTY. In normal circumstances [`process.stdin`][] will be the -only `tty.ReadStream` instance in a Node.js process and there should be no -reason to create additional instances. +* Extends: {net.Socket} + +Represents the readable side of a TTY. In normal circumstances +[`process.stdin`][] will be the only `tty.ReadStream` instance in a Node.js +process and there should be no reason to create additional instances. ### readStream.isRaw -The `tty.WriteStream` class is a subclass of [`net.Socket`][] that represents -the writable side of a TTY. In normal circumstances, [`process.stdout`][] and -[`process.stderr`][] will be the only `tty.WriteStream` instances created for a -Node.js process and there should be no reason to create additional instances. +* Extends: {net.Socket} + +Represents the writable side of a TTY. In normal circumstances, +[`process.stdout`][] and [`process.stderr`][] will be the only +`tty.WriteStream` instances created for a Node.js process and there +should be no reason to create additional instances. ### Event: 'resize'