Browse Source

Various doc tweaks (2-spaces vs tabs, EOL-whitespace, repl prompt, "world" vs "World", etc...)

v0.7.4-release
Silas Sewell 14 years ago
committed by Ryan Dahl
parent
commit
11b2ee7632
  1. 2
      doc/api/addons.markdown
  2. 16
      doc/api/repl.markdown

2
doc/api/addons.markdown

@ -43,7 +43,7 @@ To get started we create a file `hello.cc`:
init (Handle<Object> target)
{
HandleScope scope;
target->Set(String::New("hello"), String::New("World"));
target->Set(String::New("hello"), String::New("world"));
}
This source code needs to be built into `hello.node`, the binary Addon. To

16
doc/api/repl.markdown

@ -10,9 +10,9 @@ dropped into the REPL. It has simplistic emacs line-editing.
mjr:~$ node
Type '.help' for options.
node> a = [ 1, 2, 3];
> a = [ 1, 2, 3];
[ 1, 2, 3 ]
node> a.forEach(function (v) {
> a.forEach(function (v) {
... console.log(v);
... });
1
@ -27,10 +27,10 @@ For example, you could add this to your bashrc file:
alias node="env NODE_NO_READLINE=1 rlwrap node"
### repl.start(prompt='node> ', stream=process.openStdin())
### repl.start(prompt='> ', stream=process.openStdin())
Starts a REPL with `prompt` as the prompt and `stream` for all I/O. `prompt`
is optional and defaults to `node> `. `stream` is optional and defaults to
is optional and defaults to `> `. `stream` is optional and defaults to
`process.openStdin()`.
Multiple REPLs may be started against the same running instance of node. Each
@ -70,11 +70,11 @@ Inside the REPL, Control+D will exit. Multi-line expressions can be input.
The special variable `_` (underscore) contains the result of the last expression.
node> [ "a", "b", "c" ]
> [ "a", "b", "c" ]
[ 'a', 'b', 'c' ]
node> _.length
> _.length
3
node> _ += 1
> _ += 1
4
The REPL provides access to any variables in the global scope. You can expose a variable
@ -90,7 +90,7 @@ to the REPL explicitly by assigning it to the `context` object associated with e
Things in the `context` object appear as local within the REPL:
mjr:~$ node repl_test.js
node> m
> m
'message'
There are a few special REPL commands:

Loading…
Cancel
Save