Wynn Netherland changelog.com/posts

Mastering Node: Open source eBook for Node.js

GitHub is for more than just code you know. It’s a great collaboration tool for hackers. Nathan, Chris, and I use GitHub as a big part of our workflow for our upcoming book.

TJ (do we really have to say his last name by now?), of Express and now Sencha wants you to Master Node.js by reading and hacking on his own community-driven ebook.

The book will walk you through Node step-by-step from installation to topics like EventEmitter:

Typically an object inherits from EventEmitter, however our small example below illustrates the api. First we create an emitter, after which we can define any number of callbacks using the emitter.on() method which accepts the name of the event, and arbitrary objects passed as data. When emitter.emit() is called we are only required to pass the event name, followed by any number of arguments, in this case the first and last name strings.
var EventEmitter = require('events').EventEmitter;

var emitter = new EventEmitter;

emitter.on('name', function(first, last){
    console.log(first + ', ' + last);

emitter.emit('name', 'tj', 'holowaychuk');
emitter.emit('name', 'simon', 'holowaychuk');

Go ahead, fork it, contribute, and add ePub support.

[Source on GitHub]


Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00