fix x-res topic load bug

This commit is contained in:
Azareal 2020-03-23 11:42:42 +10:00
parent 0635627950
commit cdaeb477a2

View File

@ -858,16 +858,18 @@ function mainInit(){
.then(resp => { .then(resp => {
if(!resp.ok) throw(href+" failed to load"); if(!resp.ok) throw(href+" failed to load");
let xRes = resp.headers.get("x-res") let xRes = resp.headers.get("x-res")
for(let res of xRes.split(",")) { if(xRes!=null) {
let pro; for(let res of xRes.split(",")) {
if(stripQ(getExt(res)) == "css") pro = asyncGetSheet("/s/"+res) let pro;
else pro = asyncGetScript("/s/"+res) if(stripQ(getExt(res))=="css") pro = asyncGetSheet("/s/"+res)
pro.then(() => console.log("Loaded " + res)) else pro = asyncGetScript("/s/"+res)
.catch(e => { pro.then(() => console.log("Loaded "+res))
console.log("Unable to get res '"+res+"'"); .catch(e => {
console.log("e",e); console.log("Unable to get '"+res+"'");
console.trace(); console.log("e",e);
}); console.trace();
});
}
} }
return resp.text(); return resp.text();
}).then(data => { }).then(data => {