show some loadig status when page is initializing

This commit is contained in:
MrOtherGuy
2021-05-15 09:15:25 +03:00
parent 63f6da832b
commit 0095829d1d
3 changed files with 26 additions and 2 deletions

View File

@@ -472,6 +472,13 @@ function showUI(){
document.getElementById("ui").classList.remove("hidden");
}
function waitForDelay(t){
t = Number(t) || 10;
return new Promise(res =>{
setTimeout(res,t)
})
}
document.onreadystatechange = (function () {
if (document.readyState === "complete") {
@@ -494,6 +501,7 @@ document.onreadystatechange = (function () {
.then(initDB)
.then(createCategories)
.then(handleSearchQuery)
.then(()=>waitForDelay(300))
.then(showUI)
.catch(e => console.log(e))
}