Skip to content

Commit ee30267

Browse files
committed
More documentation work. Remove long lines
1 parent 03ea4b6 commit ee30267

File tree

3 files changed

+34
-90
lines changed

3 files changed

+34
-90
lines changed

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ benchmark: all
4343
# gem install ronn
4444
doc: doc/node.1 doc/api.html doc/index.html doc/changelog.html
4545

46+
## HACK to give the ronn-generated page a TOC
4647
doc/api.html: doc/api.markdown
4748
ronn -f --html doc/api.markdown \
4849
| sed "s/<h2>\(.*\)<\/h2>/<h2 id=\"\1\">\1<\/h2>/g" \

doc/api.markdown

+28-75
Original file line numberDiff line numberDiff line change
@@ -251,20 +251,20 @@ Closes the underlying file descriptor. Stream will not emit any more events.
251251

252252
A **writable stream** has the following methods, members, and events.
253253

254-
### Event 'drain'
254+
### Event: 'drain'
255255

256256
`function () { }`
257257

258258
Emitted after a `write()` method was called that returned `false` to
259259
indicate that it is safe to write again.
260260

261-
### Event 'error'
261+
### Event: 'error'
262262

263263
`function (exception) { }`
264264

265265
Emitted on error with the exception `e`.
266266

267-
### Event 'close'
267+
### Event: 'close'
268268

269269
`function () { }`
270270

@@ -400,6 +400,7 @@ Example of listening for `SIGINT`:
400400
An easy way to send the `SIGINT` signal is with `Control-C` in most terminal
401401
programs.
402402

403+
403404
### process.stdout
404405

405406
A writable stream to `stdout`.
@@ -508,13 +509,6 @@ Returns the current working directory of the process.
508509

509510
An object containing the user environment. See environ(7).
510511

511-
// print process.env
512-
var sys = require('sys');
513-
514-
Object.getOwnPropertyNames(process.env).forEach(function (val, index, array) {
515-
sys.puts(index + ': ' + val + '=' + process.env[val]);
516-
});
517-
518512

519513

520514
### process.evalcx(code, sandbox, filename)
@@ -741,65 +735,21 @@ Example of inspecting all properties of the `sys` object:
741735
To schedule execution of `callback` after `delay` milliseconds. Returns a
742736
`timeoutId` for possible use with `clearTimeout()`.
743737

744-
var sys = require('sys'),
745-
start = new Date(),
746-
timer = setTimeout(function () {
747-
sys.puts('Timer fired after ' + (Date.now() - start) + 'ms');
748-
}, 1000);
749-
750-
sys.puts('Started timer.');
751-
752-
Optionally, you can pass arguments to the callback.
753-
754-
var sys = require('sys'),
755-
start = new Date(),
756-
timer = setTimeout(function (start_time, message) {
757-
sys.puts(message + (Date.now() - start_time) + 'ms');
758-
}, 1000, start, 'Timer fired after ');
759-
760-
sys.puts('Started timer.');
761-
762-
These two examples generate the same output.
763-
764738
### clearTimeout(timeoutId)
765739

766740
Prevents a timeout from triggering.
767741

768-
var sys = require('sys'),
769-
start = new Date(),
770-
timer1 = setTimeout(function () {
771-
sys.puts('Timer fired after ' + (Date.now() - start) + 'ms');
772-
}, 5000),
773-
timer2 = setTimeout(function () {
774-
sys.puts('This is taking too long. Stopping timer1.');
775-
clearTimeout(timer1);
776-
}, 1000);
777-
778-
sys.puts('Started timers.');
779-
780742
### setInterval(callback, delay, [arg, ...])
781743

782-
To schedule the repeated execution of `callback` every `delay` milliseconds. Returns a `intervalId` for possible use with `clearInterval()`.
744+
To schedule the repeated execution of `callback` every `delay` milliseconds.
745+
Returns a `intervalId` for possible use with `clearInterval()`.
783746

784747
Optionally, you can also pass arguments to the callback.
785748

786749
### clearInterval(intervalId)
787750

788751
Stops a interval from triggering.
789752

790-
var sys = require('sys'),
791-
start = new Date(),
792-
count = 10,
793-
timer = setInterval(function () {
794-
count -= 1;
795-
sys.puts('Timer fired after ' + (Date.now() - start) + 'ms ' + count + ' remaining.');
796-
if (count === 0) {
797-
clearInterval(timer);
798-
}
799-
}, 100);
800-
801-
sys.puts('Started timer.');
802-
803753

804754
## Child Processes
805755

@@ -816,7 +766,7 @@ Child processes always have three streams associated with them. `child.stdin`,
816766

817767
`ChildProcess` is an EventEmitter.
818768

819-
### Event 'exit'
769+
### Event: 'exit'
820770

821771
`function (code) {} `
822772

@@ -1694,9 +1644,9 @@ chunked, this will send the terminating `'0\r\n\r\n'`.
16941644
This object is created when making a request with `http.Client`. It is
16951645
passed to the `'response'` event of the request object.
16961646

1697-
The response implements the stream interface.
1647+
The response implements the **readable stream** interface.
16981648

1699-
### Event 'data'
1649+
### Event: 'data'
17001650

17011651
`function (chunk) {}`
17021652

@@ -1829,24 +1779,25 @@ and passed to the user through the `'connection'` event of a server.
18291779

18301780
`function () { }`
18311781

1832-
Call once the stream is established after a call to `createConnection()` or
1833-
`connect()`.
1782+
Emitted when a stream connection successfully is established.
1783+
See `connect()`.
1784+
18341785

18351786
### Event: 'data'
18361787

18371788
`function (data) { }`
18381789

1839-
Called when data is received on the stream. `data`
1840-
will be a string. Encoding of data is set by `stream.setEncoding()`.
1790+
Emitted when data is received. The argument `data` will be a `Buffer` or
1791+
`String`. Encoding of data is set by `stream.setEncoding()`.
1792+
(See the section on Readable Streams for more infromation.)
18411793

18421794
### Event: 'end'
18431795

18441796
`function () { }`
18451797

1846-
Called when the other end of the stream sends a FIN
1847-
packet. After this is emitted the `readyState` will be
1848-
`'writeOnly'`. One should probably just call
1849-
`stream.end()` when this event is emitted.
1798+
Emitted when the other end of the stream sends a FIN packet. After this is
1799+
emitted the `readyState` will be `'writeOnly'`. One should probably just
1800+
call `stream.end()` when this event is emitted.
18501801

18511802
### Event: 'timeout'
18521803

@@ -1874,7 +1825,7 @@ following this event.
18741825

18751826
Emitted once the stream is fully closed. The argument `had_error` is a boolean which says if
18761827
the stream was closed due to a transmission
1877-
error.
1828+
error.
18781829

18791830

18801831
### net.createConnection(port, host='127.0.0.1')
@@ -1958,7 +1909,7 @@ algorithm, they buffer data before sending it off. Setting `noDelay` will
19581909
immediately fire off data each time `stream.write()` is called.
19591910

19601911

1961-
## DNS module
1912+
## DNS
19621913

19631914
Use `require('dns')` to access this module.
19641915

@@ -2049,9 +2000,10 @@ Each DNS query can return an error code.
20492000
- `dns.BADQUERY`: the query is malformed.
20502001

20512002

2052-
## Assert Module
2003+
## Assert
20532004

2054-
This module is used for writing unit tests for your applications, you can access it with `require('assert')`.
2005+
This module is used for writing unit tests for your applications, you can
2006+
access it with `require('assert')`.
20552007

20562008
### assert.fail(actual, expected, message, operator)
20572009

@@ -2094,7 +2046,7 @@ Expects `block` to throw an error.
20942046
Expects `block` not to throw an error.
20952047

20962048

2097-
## Path Module
2049+
## Path
20982050

20992051
This module contains utilities for dealing with file paths. Use
21002052
`require('path')` to use it. It provides the following methods:
@@ -2165,9 +2117,10 @@ Test whether or not the given path exists. Then, call the `callback` argument w
21652117
});
21662118

21672119

2168-
## URL Module
2120+
## URL
21692121

21702122
This module has utilities for URL resolution and parsing.
2123+
Call `require('url')` to use it.
21712124

21722125
Parsed URL objects have some or all of the following fields, depending on
21732126
whether or not they exist in the URL string. Any parts that are not in the URL
@@ -2177,7 +2130,7 @@ string will not be in the parsed object. Examples are shown for the URL
21772130

21782131
- `href`
21792132

2180-
The full URL that was originally parsed. Example:
2133+
The full URL that was originally parsed. Example:
21812134
`'http://user:[email protected]:8080/p/a/t/h?query=string#hash'`
21822135

21832136
- `protocol`
@@ -2235,7 +2188,7 @@ Take a parsed URL object, and return a formatted URL string.
22352188
Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag.
22362189

22372190

2238-
## Query String Module
2191+
## Query String
22392192

22402193
This module provides utilities for dealing with query strings. It provides the following methods:
22412194

doc/api_header.html

+5-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)