Tuesday, August 15, 2017

Dealing with javascript functions as parameters and properties

I am working on a Jsinterop wrapper for the GSAP javascript library, and I am quite new to GWT, so I have come across a few problems I am not sure how to solve. 

My main issue revolves around trying to wrap javascript functions into Java objects. 

For example, if I have a native javascript function that has a function as one of its parameters, how can I go about wrapping this function
in java? 

And if a javascript class has a function has one of its properties, how can I go about wrapping this property?

I've had some success using the @JsFunction annotation along with functional interfaces, but I am faced with the problem
where I have to declare return types, parameters, and paramater types in the java interface, when I want to be able to supply
any arbitrary function, just like I would in native javascript. Is there any way to mimic this functionality? 

Thanks for your help!


--
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