Thank you for that perfect answer.

On 06/06/2012 16:04, Tim Caswell wrote:
> A simple one-line session in the repl gives you the answer right away:
> 
> require('fs').stat(".", function (err, stat) { console.log("this", this, 
> this.__proto__ === Object.prototype, this.oncomplete === arguments.callee) })
> // OUTPUTS: this { oncomplete: [Function] } true true
> 
> As you can see, the value of this is a simple javascript Object instance with 
> an oncomplete function that is the callback you passed to the call.
> 
> I believe the value of "this" is not defined per the node public API in 
> callbacks.
> 
> On Wed, Jun 6, 2012 at 6:53 AM, Jérémy Lal <holi...@gmail.com 
> <mailto:holi...@gmail.com>> wrote:
> 
>     Hi,
> 
>     require('fs').stat('file.txt', function(err, result) {
>      console.log(this); // what is this ?
>     });
> 
>     Jérémy.
> 
>     --
>     Job Board: http://jobs.nodejs.org/
>     Posting guidelines: 
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>     You received this message because you are subscribed to the Google
>     Groups "nodejs" group.
>     To post to this group, send email to nodejs@googlegroups.com 
> <mailto:nodejs@googlegroups.com>
>     To unsubscribe from this group, send email to
>     nodejs+unsubscr...@googlegroups.com 
> <mailto:nodejs%2bunsubscr...@googlegroups.com>
>     For more options, visit this group at
>     http://groups.google.com/group/nodejs?hl=en?hl=en
> 
> 
> -- 
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: 
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to