From a77f0020541d637fb96b1f5e88db463c86fec6c1 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Wed, 7 Sep 2011 21:44:11 -0500 Subject: [PATCH] Add error handling for missing component javascript files --- web/js/map.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/web/js/map.js b/web/js/map.js index 23635ebd..9d1250cd 100644 --- a/web/js/map.js +++ b/web/js/map.js @@ -307,7 +307,9 @@ DynMap.prototype = { configset[configuration.type].push(configuration); }); + var tobeloaded = {}; $.each(configset, function(type, configlist) { + tobeloaded[type] = true; loadjs('js/' + type + '.js', function() { var componentconstructor = componentconstructors[type]; if (componentconstructor) { @@ -317,6 +319,7 @@ DynMap.prototype = { } else { // Could not load component. We'll ignore this for the moment. } + delete tobeloaded[type]; componentstoload--; if (componentstoload == 0) { // Actually start updating once all components are loaded. @@ -324,6 +327,17 @@ DynMap.prototype = { } }); }); + setTimeout(function() { + $.each(configset, function(type, configlist) { + if(tobeloaded[type]) { + me.alertbox + .text('Error loading js/' + type + '.js') + .show(); + } + }); + if(componentstoload > 0) + setTimeout(function() { me.update(); }, me.options.updaterate); + }, 15000); }, getProjection: function() { return this.maptype.getProjection(); }, selectMapAndPan: function(map, location, completed) {