>
> As I said, it would work sporadically, but not always.  An non-static 
> example would be very useful as I still don't completely understand why it 
> needed to be wrapped with an anonymous function.
>

Because $wnd.log = $entry(myInstance.@package.Class::log()) kind of means 
"assign/copy the method definition of myInstance.log() to $wnd.log". When 
you now call $wnd.log() from JS, the code inside $wnd.log() is executed in 
the context of $wnd and not in the context of myInstance. Thats why this inside 
$wnd.log() is now $wnd and not myInstance. 

When you wrap it in an anonymous function it means "assign an anonymous 
function to $wnd.log and when that function executes call myInstance.log()". 
Now you are calling the real myInstance.log() method and this is what it 
should be.

-- J.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to