Yes, but it will require Java8, which allows interfaces to contain
static methods. Here's how you'll do it soon when the Java8 stuff
lands:

@JsType
public interface ImageUtils {
 public static Texture loadTexture(String url)  { return
js("$wnd.THREE.ImageUtils.loadTexture($0)", url); }
}

ImageUtils.loadTexture(url);



On Sat, Oct 4, 2014 at 8:18 AM, confile <michael.gorsk...@googlemail.com> wrote:
> Consider the following static JavaScript function:
>
> THREE.ImageUtils = {
>        loadTexture: function (url) { ... }
>
> }
>
> The way I use to create the static function with JsInterop is to create an
> interface for ImageUtils and then create an inner abstract class MyStatic
> which contains the static methods implemented with JSNI.
>
> Here is an example of the above class:
>
> @JsType
> public interface ImageUtils {
>
> public static abstract class MyStatic {
>
> public static native Texture create(String url) /*-{
> return new $wnd.THREE.ImageUtils.loadTexture(url);
> }-*/;
> }
>
> }
>
>
> I don't think this is the best solution. Is there a better way to handle
> static functions with JsInterop?
>
> --
> You received this message because you are subscribed to the Google Groups
> "GWT Contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-web-toolkit-contributors/8f6cf42a-2910-4536-a2f7-1ae2d55422ac%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAPVRV7fHxYi_8NQjcCNPUtb7WspuNfvL95Nr3NzFpsqWq49j0Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to