Thanks for the quick responses. That makes sense that since the jsni method is declared static that you can't use this, but I'm not following Thomas's explanation. Maybe I could just get an explanation from the docs example here:
http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html#methods-fields Under the example: Accessing Java fields from JavaScript Where it has: public class JSNIExample { String myInstanceField; static int myStaticField; void instanceFoo(String s) { // use s } static void staticFoo(String s) { // use s } public native void bar(JSNIExample x, String s) /*-{ // Call instance method instanceFoo() on this [email protected]::instanceFoo(Ljava/lang/String;)(s); // Call instance method instanceFoo() on x [email protected]::instanceFoo(Ljava/lang/String;)(s); // Call static method staticFoo() @com.google.gwt.examples.JSNIExample::staticFoo(Ljava/lang/String;)(s); What's the difference here between using the 'this' and the passed in 'x'? What does 'this' represent in this example? As for Thomas's explanation, are you saying that by calling $entry it creates a new inner function (or closure) where 'this' is no longer what it was? So if I didn't use $entry then 'this' would be what I expect it is? Thanks again for the help! Robert On Sat, Feb 15, 2014 at 4:26 AM, Jens <[email protected]> wrote: >> >> $wnd.log = $entry(function(msg) { >> [email protected]::log(Ljava/lang/String;)(msg); }); > > > Oh right. Somehow I totally ignored the method parameter that needs to be passed around. > > > -- J. > > -- > You received this message because you are subscribed to a topic in the Google Groups "Google Web Toolkit" group. > To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/rJAnzDPb_2Y/unsubscribe . > To unsubscribe from this group and all its topics, send an email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/google-web-toolkit. > For more options, visit https://groups.google.com/groups/opt_out. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
