Embed: retry failed CSS load (3x)
This commit is contained in:
parent
e96799d5ac
commit
8cd51e5e7d
2 changed files with 25 additions and 14 deletions
File diff suppressed because one or more lines are too long
|
@ -453,19 +453,30 @@ var MistUtil = {
|
||||||
else {
|
else {
|
||||||
//retrieve file contents
|
//retrieve file contents
|
||||||
cache[url] = [onCSSLoad];
|
cache[url] = [onCSSLoad];
|
||||||
MistUtil.http.get(url,function(d){
|
|
||||||
for (var i in cache[url]) {
|
//try to load 3 times, then give up
|
||||||
cache[url][i](d);
|
var attempts = 3;
|
||||||
}
|
function retry() {
|
||||||
cache[url] = d;
|
MistUtil.http.get(url,function(d){
|
||||||
},function(){
|
for (var i in cache[url]) {
|
||||||
var d = "/*Failed to load*/";
|
cache[url][i](d);
|
||||||
for (var i in cache[url]) {
|
}
|
||||||
cache[url][i](d);
|
cache[url] = d;
|
||||||
}
|
},function(){
|
||||||
cache[url] = d;
|
if (attempts > 0) {
|
||||||
|
attempts--;
|
||||||
});
|
setTimeout(retry,2e3);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var d = "/*Failed to load*/";
|
||||||
|
for (var i in cache[url]) {
|
||||||
|
cache[url][i](d);
|
||||||
|
}
|
||||||
|
cache[url] = d;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
retry();
|
||||||
}
|
}
|
||||||
|
|
||||||
return style; //its empty now, but will be filled on load
|
return style; //its empty now, but will be filled on load
|
||||||
|
|
Loading…
Add table
Reference in a new issue