That can still be done in JsInterop through the Js class - Js.cast does it safely, and Js.uncheckedCast does your JSNI version, but in a way that will continue to work correctly in J2CL.
The class also contains casts to all primitives.
If you are using elemental2, this should already be on your classpath, otherwise you can add it from maven using
On Wednesday, October 18, 2017 at 9:34:41 AM UTC-5, Vassilis Virvilis wrote:
-- The class also contains casts to all primitives.
If you are using elemental2, this should already be on your classpath, otherwise you can add it from maven using
<dependency>
<groupId>com.google.jsinterop</groupId>
<artifactId>base</artifactId>
<version>1.0.0-beta-1</version>
</dependency>
On Wednesday, October 18, 2017 at 9:34:41 AM UTC-5, Vassilis Virvilis wrote:
Thomas advice is of course preferableBut sometimes gwt type checking drives me crazy. Then I use thisJsUtil.java----public static native <T, V> V cast(T data) /*-{
return data;
}-*/;
----This casts anything to anything...VassilisOn Wed, Oct 18, 2017 at 2:39 PM, Thomas Broyer <t.br...@gmail.com> wrote:You should be able to cast a JSO to a JsType (native ones only?)
And in this case they indeed represent the same kind of objects so this is safe.
--
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-we...@googlegroups.com .
Visit this group at https://groups.google.com/group/google-web-toolkit .
For more options, visit https://groups.google.com/d/optout .
--Vassilis Virvilis
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