Most of the Node API docs don't use this keyword inside event handler. For example below code prefers readable.read() instead of this.read(). Although both works fine.
Using "this" makes it generic and we can define callback function outside and can be used as reference inside on method.
Thoughts please.
Example1: why not this.read() ?
readable.on('readable', function() {
var chunk;
while (null !== (chunk = readable.read())) {
console.log('got %d bytes of data', chunk.length);
}
});
Example2: why not this.address() ?
server.listen(function() {
address = server.address();
console.log("opened server on %j", address);
});
Note: Event section of API says "Inside a listener function, this refers to the EventEmitter that the listener was attached to. " but I don't see said practice at all in the example codes.