branflake2267 / GWT-Maps-V3-Api

GWT Maps V3 Javascript Bindings
Other
144 stars 113 forks source link

Is it possible to get notified if LoadApi.go failed? #207

Closed ghost closed 10 years ago

ghost commented 10 years ago

Is there any way to know if the LoadApi.go(...) call failed, i.e. when the Google Maps library wasn't successfully loaded?

twistedpair commented 10 years ago

LoadApi.java is a thin wrapper around the Google AjaxLoader library.

As you can see from that source, there is an on success callback, but not an on failure callback. We implement the success callback in the method: LoadApi#go(Runnable onLoad, boolean sensor)

Thus, without branching and modifying the underlying library, there is no simple way to add said functionality. It would be simpler to assume that if you've not received the success callback, then it has failed. You could start a timer and if it expires, say after 10s, then you could assume failure, but this would be risky on slower mobile connections, so you might want to add additional heuristics.