Skip to content

Commit be5a8e2

Browse files
AndreasMadsenbnoordhuis
authored andcommitted
doc: consistent use of the callback argument
1 parent 8c5f269 commit be5a8e2

File tree

5 files changed

+37
-24
lines changed

5 files changed

+37
-24
lines changed

doc/api/domain.markdown

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,9 @@ from that one, and bound to this one instead.
184184
The opposite of `domain.add(emitter)`. Removes domain handling from the
185185
specified emitter.
186186

187-
### domain.bind(cb)
187+
### domain.bind(callback)
188188

189-
* `cb` {Function} The callback function
189+
* `callback` {Function} The callback function
190190
* return: {Function} The bound function
191191

192192
The returned function will be a wrapper around the supplied callback
@@ -210,16 +210,16 @@ thrown will be routed to the domain's `error` event.
210210
// with the normal line number and stack message.
211211
});
212212

213-
### domain.intercept(cb)
213+
### domain.intercept(callback)
214214

215-
* `cb` {Function} The callback function
215+
* `callback` {Function} The callback function
216216
* return: {Function} The intercepted function
217217

218-
This method is almost identical to `domain.bind(cb)`. However, in
218+
This method is almost identical to `domain.bind(callback)`. However, in
219219
addition to catching thrown errors, it will also intercept `Error`
220220
objects sent as the first argument to the function.
221221

222-
In this way, the common `if (er) return cb(er);` pattern can be replaced
222+
In this way, the common `if (er) return callback(er);` pattern can be replaced
223223
with a single error handler in a single place.
224224

225225
#### Example

doc/api/http.markdown

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,10 @@ This function is asynchronous. The last parameter `callback` will be added as
156156
a listener for the ['listening'][] event. See also [net.Server.listen(path)][].
157157

158158

159-
### server.listen(handle, [listeningListener])
159+
### server.listen(handle, [callback])
160160

161161
* `handle` {Object}
162-
* `listeningListener` {Function}
162+
* `callback` {Function}
163163

164164
The `handle` object can be set to either a server or socket (anything
165165
with an underlying `_handle` member), or a `{fd: <n>}` object.
@@ -172,9 +172,9 @@ Listening on a file descriptor is not supported on Windows.
172172

173173
This function is asynchronous. The last parameter `callback` will be added as
174174
a listener for the ['listening'](net.html#event_listening_) event.
175-
See also [net.Server.listen()](net.html#server.listen).
175+
See also [net.Server.listen()](net.html#net_server_listen_handle_callback).
176176

177-
### server.close([cb])
177+
### server.close([callback])
178178

179179
Stops the server from accepting new connections. See [net.Server.close()][].
180180

@@ -917,9 +917,9 @@ Resumes a paused response.
917917
[http.request()]: #http_http_request_options_callback
918918
[http.ServerRequest]: #http_class_http_serverrequest
919919
['listening']: net.html#net_event_listening
920-
[net.Server.close()]: net.html#net_server_close_cb
921-
[net.Server.listen(path)]: net.html#net_server_listen_path_listeninglistener
922-
[net.Server.listen(port)]: net.html#net_server_listen_port_host_backlog_listeninglistener
920+
[net.Server.close()]: net.html#net_server_close_callback
921+
[net.Server.listen(path)]: net.html#net_server_listen_path_callback
922+
[net.Server.listen(port)]: net.html#net_server_listen_port_host_backlog_callback
923923
[Readable Stream]: stream.html#stream_readable_stream
924924
[socket.setKeepAlive()]: net.html#net_socket_setkeepalive_enable_initialdelay
925925
[socket.setNoDelay()]: net.html#net_socket_setnodelay_nodelay

doc/api/https.markdown

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ Or
4646
res.end("hello world\n");
4747
}).listen(8000);
4848

49+
50+
### server.listen(port, [host], [backlog], [callback])
51+
### server.listen(path, [callback])
52+
### server.listen(handle, [callback])
53+
54+
See [http.listen()][] for details.
55+
56+
### server.close([callback])
57+
58+
See [http.close()][] for details.
59+
4960
## https.request(options, callback)
5061

5162
Makes a request to a secure web server.
@@ -193,6 +204,8 @@ Global instance of [https.Agent][] for all HTTPS client requests.
193204

194205
[Agent]: #https_class_https_agent
195206
[globalAgent]: #https_https_globalagent
207+
[http.listen()]: http.html#http_server_listen_port_hostname_backlog_callback
208+
[http.close()]: http.html#http_server_close_callback
196209
[http.Agent]: http.html#http_class_http_agent
197210
[http.request()]: http.html#http_http_request_options_callback
198211
[https.Agent]: #https_class_https_agent

doc/api/net.markdown

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ The `connectListener` parameter will be added as an listener for the
118118
This class is used to create a TCP or UNIX server.
119119
A server is a `net.Socket` that can listen for new incoming connections.
120120

121-
### server.listen(port, [host], [backlog], [listeningListener])
121+
### server.listen(port, [host], [backlog], [callback])
122122

123123
Begin accepting connections on the specified `port` and `host`. If the
124124
`host` is omitted, the server will accept connections directed to any
@@ -130,7 +130,7 @@ The actual length will be determined by your OS through sysctl settings such as
130130
parameter is 511 (not 512).
131131

132132
This function is asynchronous. When the server has been bound,
133-
['listening'][] event will be emitted. The last parameter `listeningListener`
133+
['listening'][] event will be emitted. The last parameter `callback`
134134
will be added as an listener for the ['listening'][] event.
135135

136136
One issue some users run into is getting `EADDRINUSE` errors. This means that
@@ -150,18 +150,18 @@ would be to wait a second and then try again. This can be done with
150150
(Note: All sockets in Node set `SO_REUSEADDR` already)
151151

152152

153-
### server.listen(path, [listeningListener])
153+
### server.listen(path, [callback])
154154

155155
Start a UNIX socket server listening for connections on the given `path`.
156156

157157
This function is asynchronous. When the server has been bound,
158-
['listening'][] event will be emitted. The last parameter `listeningListener`
158+
['listening'][] event will be emitted. The last parameter `callback`
159159
will be added as an listener for the ['listening'][] event.
160160

161-
### server.listen(handle, [listeningListener])
161+
### server.listen(handle, [callback])
162162

163163
* `handle` {Object}
164-
* `listeningListener` {Function}
164+
* `callback` {Function}
165165

166166
The `handle` object can be set to either a server or socket (anything
167167
with an underlying `_handle` member), or a `{fd: <n>}` object.
@@ -174,10 +174,10 @@ Listening on a file descriptor is not supported on Windows.
174174

175175
This function is asynchronous. When the server has been bound,
176176
['listening'](#event_listening_) event will be emitted.
177-
the last parameter `listeningListener` will be added as an listener for the
177+
the last parameter `callback` will be added as an listener for the
178178
['listening'](#event_listening_) event.
179179

180-
### server.close([cb])
180+
### server.close([callback])
181181

182182
Stops the server from accepting new connections and keeps existing
183183
connections. This function is asynchronous, the server is finally

doc/api/tls.markdown

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ You can test this server by connecting to it with `openssl s_client`:
208208
openssl s_client -connect 127.0.0.1:8000
209209

210210

211-
## tls.connect(options, [secureConnectListener])
212-
## tls.connect(port, [host], [options], [secureConnectListener])
211+
## tls.connect(options, [callback])
212+
## tls.connect(port, [host], [options], [callback])
213213

214214
Creates a new client connection to the given `port` and `host` (old API) or
215215
`options.port` and `options.host`. (If `host` is omitted, it defaults to
@@ -249,7 +249,7 @@ Creates a new client connection to the given `port` and `host` (old API) or
249249

250250
- `servername`: Servername for SNI (Server Name Indication) TLS extension.
251251

252-
The `secureConnectListener` parameter will be added as a listener for the
252+
The `callback` parameter will be added as a listener for the
253253
['secureConnect'][] event.
254254

255255
`tls.connect()` returns a [CleartextStream][] object.

0 commit comments

Comments
 (0)