-
-
Save alejandro/1350401 to your computer and use it in GitHub Desktop.
Am I the only one that finds this more readable?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var util = require("util"); | |
| var inherits = function (inherits, fn) { | |
| util.inherits(fn, inherits); | |
| return fn; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| josh@onix:/tmp/inherits$ node | |
| > var inherits = require("./inherits"); | |
| > var EE = require("events").EventEmitter; | |
| > | |
| > var FooBar = inherits(EE, function () { | |
| ... this.on("foo", function () { | |
| ... console.log("bar"); | |
| ... }); | |
| ... }); | |
| > | |
| > var foobar = new FooBar; | |
| > | |
| > foobar.emit("foo"); | |
| bar | |
| true | |
| > | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment