Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'integration'

  • Loading branch information...
commit 4f950607e57280de216301f4af97a230f842622d 2 parents c42b7b8 + 93adcc1
@tj tj authored
View
2  chapters/events.md
@@ -20,7 +20,7 @@ Typically an object inherits from _EventEmitter_, however our small example belo
## Inheriting From EventEmitter
-A perhaps more practical use of `EventEmitter`, and commonly used throughout node is to inherit from it. This means we can leave `EventEmitter`'s prototype untouched, while utilizing it's api for our own means of world domination!
+A perhaps more practical use of `EventEmitter`, and commonly used throughout node is to inherit from it. This means we can leave `EventEmitter`'s prototype untouched, while utilizing its api for our own means of world domination!
To do so we begin by defining the `Dog` constructor, which of course will bark from time to time, also known as an _event_. Our `Dog` constructor accepts a `name`, followed by `EventEmitter.call(this)`, which invokes the `EventEmitter` function in context to the given argument. Doing this is essentially the same as a "super" or "parent" call in languages that support classes. This is a crucial step, as it allows `EventEmitter` to set up the `_events` property which it utilizes internally to manage callbacks.
View
4 chapters/globals.md
@@ -5,7 +5,7 @@
## console
-The `console` object contains several methods which are used to output information to _stdout_ or _stderr_. Lets take a look at what each method does.
+The `console` object contains several methods which are used to output information to _stdout_ or _stderr_. Let's take a look at what each method does.
### console.log()
@@ -162,7 +162,7 @@ The process itself is an `EventEmitter`, allowing you to do things like listen f
### errno
-The `process` object is host of the error numbers, these reference what you would find in C-land, for example `process.EPERM` represents a permission based error, while `process.ENOENT` represents a missing file or directory. Typically these are used within bindings to bridge the gap between c++ and JavaScript, however useful for handling exceptions as well:
+The `process` object is host of the error numbers, these reference what you would find in C-land, for example `process.EPERM` represents a permission based error, while `process.ENOENT` represents a missing file or directory. Typically these are used within bindings to bridge the gap between C++ and JavaScript, however useful for handling exceptions as well:
if (err.errno === process.ENOENT) {
// Display a 404 "Not Found" page
View
4 chapters/installation.md
@@ -1,7 +1,7 @@
# Installing Node
-In this chapter we will be looking at the installation and compilation of node. Although there are several ways we may install node, we will be looking at [homebrew](http://github.com/mxcl/homebrew), [nDistro](http://github.com/visionmedia/ndistro), and the most flexible method of course, compiling from source.
+In this chapter we will be looking at the installation and compilation of node. Although there are several ways we may install node, we will be looking at [homebrew](http://github.com/mxcl/homebrew), [nDistro](http://github.com/visionmedia/ndistro), and the most flexible method, of course - compiling from source.
### Homebrew
@@ -34,7 +34,7 @@ Next we can place the contents of our example in _./.ndistro_, and execute _ndis
$ ndistro
-Installation of the example took less than 17 seconds on my machine, and outputs the following _stdout_ indicating success, not bad for an entire stack!
+Installation of the example took less than 17 seconds on my machine, and outputs the following _stdout_ indicating success. Not bad for an entire stack!
... installing node-0.1.102-i386
... installing connect
View
8 chapters/modules.md
@@ -7,7 +7,7 @@ Although this is ideal, in practice modules are often not portable due to relyin
## Creating Modules
-Lets create a utility module named _utils_, which will contain a `merge()` function to copy the properties of one object to another. Typically in a browser, or environment without CommonJS module support, this may look similar to below, where `utils` is a global variable.
+Let's create a utility module named _utils_, which will contain a `merge()` function to copy the properties of one object to another. Typically in a browser, or environment without CommonJS module support, this may look similar to below, where `utils` is a global variable.
var utils = {};
utils.merge = function(obj, other) {};
@@ -174,9 +174,9 @@ Outputs:
## Registering Module Compilers
-Another cool feature that node provides us, is the ability to register compilers for a specific file extension. A good example of this is the CoffeeScript language, which is a ruby/python inspired language compiling to vanilla JavaScript, and through the use of `require.registerExtension()` can do so in an automated fashion.
+Another cool feature that node provides us is the ability to register compilers for a specific file extension. A good example of this is the CoffeeScript language, which is a ruby/python inspired language compiling to vanilla JavaScript. By using `require.registerExtension()` we can have node compile CoffeeScript to JavaScript in an automated fashion.
-To illustrate it's usage, lets create a small (and useless) Extended JavaScript language, or "ejs" for our example which will live at _./compiler/example.ejs_, it's syntax will look like this:
+To illustrate its usage, let's create a small (and useless) Extended JavaScript language, or "ejs" for our example which will live at _./compiler/example.ejs_, its syntax will look like this:
::min(a, b) a < b ? a : b
::max(a, b) a > b ? a : b
@@ -186,7 +186,7 @@ which will be compiled to:
exports.min = function min(a, b) { return a < b ? a : b }
exports.max = function max(a, b) { return a > b ? a : b }
-First lets create the module that will actually be doing the ejs to JavaScript compilation. In this example it is located at _./compiler/extended.js_, and exports a single method named `compile()`. This method accepts a string, which is the raw contents of what node is requiring, transformed to vanilla JavaScript via regular expressions.
+First let's create the module that will actually be doing the ejs to JavaScript compilation. In this example it is located at _./compiler/extended.js_, and exports a single method named `compile()`. This method accepts a string, which is the raw contents of what node is requiring, transformed to vanilla JavaScript via regular expressions.
exports.compile = function(str){
Please sign in to comment.
Something went wrong with that request. Please try again.