Wrap google.maps with JSInterop

Skip to first unread message


Apr 28, 2020, 10:53:55 AM4/28/20
to GWT Users
I'm trying to wrap google.maps with JSInterop. Everything works perfectly locally with SDM but when I perform a full compile and deploy to App Engine I get:

(TypeError) : undefined is not an object (evaluating 'new (wuc[l]=FZc+fwc,$wnd).google.maps')

at this line:

LatLng latLng = new LatLng(62.3875, 16.325556);

package console.map;

import jsinterop.annotations.JsConstructor;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;

@JsType(isNative = true, namespace = "google.maps")
public class LatLng {
public LatLng(double lat, double lng) {}

public native double getLat();

public native void setLat(double lat);

public native double getLng();

public native void setLng(double lng);

I have set the compile flag:

What's wrong?


Apr 29, 2020, 3:18:05 AM4/29/20
to GWT Users

I have set the compile flag:

You only need this when using @JsType(isNative = false) in your code.

Generally you have to wait until external JS has been loaded before you can access it in your GWT code. Maybe your GWT code runs too early?

-- J.

Carl Rahmström

Apr 29, 2020, 3:58:47 AM4/29/20
to GWT Users
Your post made me check if the external JS had been loaded and sure enough it hadn't. Turned out it was being downloaded over http instead of https and therefore rejected. Simple mistake, thank you for pointing me in the right direction.

You received this message because you are subscribed to a topic in the Google Groups "GWT Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/tKCb17530XE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-web-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/6b3de4da-22d2-463c-9edf-2096c5a0af09%40googlegroups.com.

Reply all
Reply to author
0 new messages