Tuesday, 20 August 2013

How to handle requireJs timeout error?

How to handle requireJs timeout error?

I'm writing a mobile hybrid app using require.js as my loading framework.
I have an issue with loading errors. What I'm trying to do is setup a
fallback solution when the device is offline and I can't download the
google maps API script that I need to display a map on the screen. All
that I get is
Uncaught Error: Load timeout for modules:
async!http://maps.googleapis.com/maps/api/js?sensor=true
but I'm not able to catch this error and provide an alternative
implementation. Here is my gmaps module definition
define('gmaps',
['async!http://maps.googleapis.com/maps/api/js?sensor=true'],function(){
return window.google.maps; // mappatura nel più corto gmaps
});
What can I do?

No comments:

Post a Comment