Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Regenerated book

  • Loading branch information...
commit d0550778e5011d9fb151c100b276a2b83c5d122a 1 parent 4e5125a
@tj tj authored
View
BIN  book.epub
Binary file not shown
View
3  book.html
@@ -547,13 +547,12 @@ <h2 id="Inheriting-From-EventEmitter">Inheriting From EventEmitter</h2>
<p>A perhaps more practical use of <code>EventEmitter</code>, and commonly used throughout node is to inherit from it. This means we can leave <code>EventEmitter</code>'s prototype untouched, while utilizing its api for our own means of world domination!</p>
-<p>To do so we begin by defining the <code>Dog</code> constructor, which of course will bark from time to time, also known as an <em>event</em>. Our <code>Dog</code> constructor accepts a <code>name</code>, followed by <code>EventEmitter.call(this)</code>, which invokes the <code>EventEmitter</code> 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 <code>EventEmitter</code> to set up the <code>_events</code> property which it utilizes internally to manage callbacks.</p>
+<p>To do so we begin by defining the <code>Dog</code> constructor, which of course will bark from time to time, also known as an <em>event</em>.</p>
<pre><code>var EventEmitter = require('events').EventEmitter;
function Dog(name) {
this.name = name;
- EventEmitter.call(this);
}
</code></pre>
View
BIN  book.mobi
Binary file not shown
View
BIN  book.pdf
Binary file not shown
View
3  chapters/events.html
@@ -22,13 +22,12 @@ <h2 id="Inheriting-From-EventEmitter">Inheriting From EventEmitter</h2>
<p>A perhaps more practical use of <code>EventEmitter</code>, and commonly used throughout node is to inherit from it. This means we can leave <code>EventEmitter</code>'s prototype untouched, while utilizing its api for our own means of world domination!</p>
-<p>To do so we begin by defining the <code>Dog</code> constructor, which of course will bark from time to time, also known as an <em>event</em>. Our <code>Dog</code> constructor accepts a <code>name</code>, followed by <code>EventEmitter.call(this)</code>, which invokes the <code>EventEmitter</code> 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 <code>EventEmitter</code> to set up the <code>_events</code> property which it utilizes internally to manage callbacks.</p>
+<p>To do so we begin by defining the <code>Dog</code> constructor, which of course will bark from time to time, also known as an <em>event</em>.</p>
<pre><code>var EventEmitter = require('events').EventEmitter;
function Dog(name) {
this.name = name;
- EventEmitter.call(this);
}
</code></pre>
Please sign in to comment.
Something went wrong with that request. Please try again.