Browse Source

Changed timeout function for loading Google Docs so that it tries several times to get json ref #219

pull/246/head
Zach Wise 13 years ago
parent
commit
0bf00ea34c
  1. 14
      source/js/VMM.Timeline.DataObj.js

14
source/js/VMM.Timeline.DataObj.js

@ -166,17 +166,24 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
googlespreadsheet: {
getData: function(raw) {
var key, url, timeout;
var getjsondata, key, url, timeout, tries = 0;
key = VMM.Util.getUrlVars(raw)["key"];
url = "https://spreadsheets.google.com/feeds/list/" + key + "/od6/public/values?alt=json";
timeout = setTimeout(function() {
trace("Google Docs timeout");
if (tries < 3) {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Still waiting on Google Docs, trying again " + tries);
tries ++;
requestJsonData();
} else {
VMM.fireEvent(global, VMM.Timeline.Config.events.messege, "Google Docs is not responding");
}
}, 6000);
VMM.getJSON(url, VMM.Timeline.DataObj.model.googlespreadsheet.buildData)
function requestJsonData() {
getjsondata = VMM.getJSON(url, VMM.Timeline.DataObj.model.googlespreadsheet.buildData)
.error(function(jqXHR, textStatus, errorThrown) {
trace("Google Docs ERROR");
trace("Google Docs ERROR: " + textStatus + " " + jqXHR.responseText);
@ -184,6 +191,9 @@ if (typeof VMM.Timeline !== 'undefined' && typeof VMM.Timeline.DataObj == 'undef
.success(function(d) {
clearTimeout(timeout);
});
}
requestJsonData();
},
buildData: function(d) {

Loading…
Cancel
Save