'this' is a keyword, which depends on the way the function has been called. 
Because you do not pass "this" as an argument to addHandler, it's clear that 
the function you pass won't ever be called with its "this" set to the value 
of "this" at the time you called addHandler. Storing "this" in to a variable 
works around it.

in Java, this is a bit similar to the "this" in anonymous classes refering 
to the anonymous class, and not the class it was defined in. However, in 
Java, you have the TheParentClass.this notation; that does not exist in 
JavaScript (and, "this" is contextual to the *call* in JS, whereas it's 
contextual to the *declaration* in Java; always).

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/YV5kST9OYqAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to