diff --git a/node.html b/node.html index fc72e5ec9df..2cfaa6760ab 100644 --- a/node.html +++ b/node.html @@ -30,7 +30,7 @@ body { } #toc a { color: #777; } -h1, h2, h3 { color: inherit; } +h1, h2, h3 { color: #aaf; } h1 { margin: 2em 0; @@ -42,7 +42,6 @@ h1 { h1 a { color: inherit; } h2 { - margin: 2em 0; font-size: 45px; line-height: inherit; font-weight: bold; @@ -58,13 +57,18 @@ h3 { pre, code { font-family: monospace; font-size: 13pt; + color: #eae; +} + +pre { + padding-left: 2em; } dl { } dt { - color: #f55; + color: #aaf; font-weight: bold; } @@ -76,6 +80,11 @@ dd { a { color: #cd5; text-decoration: none; } a:hover { text-decoration: underline; } +.highlight { + background: #733; + padding: 0.2em 0; +} +
Node is a purely evented I/O framework for V8 javascript. For example, this is a -simple web server which responds with "Hello World" after waiting two -seconds: +
Node is a purely asynchronous I/O framework for V8 javascript. + +
This is an example of a web server written with Node which responds with +"Hello World" after waiting two seconds:
new node.http.Server(function (msg) {
setTimeout(function () {
@@ -351,7 +361,8 @@ msg.sendHeader( 200
Modules
-Node has simple module loading. Here is an example of loading a module:
+
Node has simple module loading. Here is an example. This is the file
+foo.js:
include("mjsunit");
@@ -362,14 +373,17 @@ function onLoad () {
Here the module mjsunit has provided the function
assertEquals().
-
The file mjsunit.js must be in the same directory for this
-to work. The include() function will take all the exported
-objects from the file and put them into the global namespace. Because file
-loading does not happen instantaniously, and because Node has a policy of
-never blocking, the callback onLoad() is provided to notify the
-user when all the exported functions are completely loaded.
+
The module file, mjsunit.js, must be in the same directory
+as foo.js for include() to work. The
+include() function will insert all the exported objects from the
+module into the global namespace.
-
To export an object, add to the special object exports.
+
Because file loading does not happen instantaneously, and because Node
+has a policy of never blocking, the callback onLoad() is
+provided to notify the user when all the exported functions are completely
+loaded.
+
+
To export an object, add to the special object exports.
Let's look at how mjsunit.js does this
@@ -381,7 +395,7 @@ function deepEquals (a, b) {
// ...
}
-exports.assertEquals = function (expected, found, name_opt) {
+exports.assertEquals = function (expected, found, name_opt) {
if (!deepEquals(found, expected)) {
fail(expected, found, name_opt);
}
@@ -393,7 +407,7 @@ exported and remain private to the module.
In addition to include() a module can use
require(). Instead of loading the exported objects into the
global namespace, it will return a namespace object. Again, the members of
-the namespace object can only be guarenteed to exist after the
+the namespace object can only be guaranteed to exist after the
onLoad() callback is made. For example:
var mjsunit = require("mjsunit");
diff --git a/src/net.cc b/src/net.cc
index f4f7320b3ee..fb1defe0064 100644
--- a/src/net.cc
+++ b/src/net.cc
@@ -57,7 +57,7 @@ Connection::Initialize (v8::Handle target)
NODE_SET_PROTOTYPE_METHOD(constructor_template, "fullClose", v8FullClose);
NODE_SET_PROTOTYPE_METHOD(constructor_template, "forceClose", v8ForceClose);
- target->Set(String::NewSymbol("TCPConnection"), constructor_template->GetFunction());
+ target->Set(String::NewSymbol("Connection"), constructor_template->GetFunction());
}
Connection::Connection (Handle