JSNI madness!

65 views
Skip to first unread message

Roger Studner

unread,
May 15, 2012, 10:39:48 AM5/15/12
to Google Web Toolkit
Okay, losing my mind on something trivial.. if I have

public class FooBar {

public static native void methodA() /*-{
FooBar.methodB();
/*-};

public static native void methidB() /*-{
$wnd.alert("hi!");

/*-};



}

this should work? I feel like i've done it 1000 times, but now when I do this, I never can call "one JSNI method from another"

Anyone :)? Bueller?

Roger

Roger Studner

unread,
May 15, 2012, 10:42:50 AM5/15/12
to google-we...@googlegroups.com
Okay, not quite a complete enough example:

public class FooBar {

public static native void methodA() /*-{
something.bind("hi", function () {
FooBar.methodB();
});

/*-};

public static native void methidB() /*-{
$wnd.alert("hi!");

/*-};

that is more accurate (the fact that i'm trying to access it inside of a function, which affects "scope" to some degree of course

Best,
Roger
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>

Thomas Broyer

unread,
May 15, 2012, 11:16:40 AM5/15/12
to google-we...@googlegroups.com


On Tuesday, May 15, 2012 4:39:48 PM UTC+2, Roger wrote:
Okay, losing my mind on something trivial.. if I have

public class FooBar {

  public static native void methodA() /*-{
                FooBar.methodB();

@my.pack.age.FooBar::methodB()();

Roger Studner

unread,
May 15, 2012, 11:21:20 AM5/15/12
to google-we...@googlegroups.com
For some reason I was thinking/hoping that a "JSNI to JSNI call" wouldn't use the evil syntax.

<crawls back to type in the evil syntax>

Thanks Thomas!

Roger

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.

Joseph Lust

unread,
May 16, 2012, 2:51:58 PM5/16/12
to google-we...@googlegroups.com
methidB() should be methodB()


Sincerely,
Joseph

Wendel

unread,
May 20, 2012, 8:52:08 AM5/20/12
to google-we...@googlegroups.com
 public static native void methodA() /*-{    
    var that = this;

    something.bind("hi", function () {
          that.@my.pack.age.FooBar.methodB();
    });    
}-*/;



Reply all
Reply to author
Forward
0 new messages