Monday, January 15, 2018

@FunctionalInterface VS @JsFunction

Hi,

Would it be possible for GWTc to handle java.lang.FunctionalInterface as if it was jsinterop.annotations.JsFunction ?
The reason for asking is, I have this java code:

    public void transaction(Runnable runnable) {
        startTransaction();
        try {
            runnable.run();
        }
        finally {
            endTransaction();
        }
    }

when I expose this method via jsinterop I get a warning "not usable from javascript"

I intent to use it from JS/TS as: myJavaLib.transaction(() => doSomethingInTransaction(...));

but this is not possible unless I supersource java.lang.Runnable and add @JsFunction 

It seems to me that @FunctionalInterface and @JsFunction are very similar already...

Regards Jan 


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

No comments:

Post a Comment