Show loading progress

This commit is contained in:
Varun Patil 2020-05-07 15:05:27 +05:30
parent 2de283af8e
commit 30c4b1d594
2 changed files with 66 additions and 13 deletions

View file

@ -13,9 +13,6 @@ EM_JS(void, load_file_async_js, (const char* fullPathC), {
// Check if already loaded
if (window.fileAsyncCache.hasOwnProperty(fullPath)) return wakeUp();
// Show spinner
if (window.setBusy) window.setBusy();
// Get mapping key
const mappingKey = fullPath.toLowerCase().replace(new RegExp("\\\\.[^/.]+$"), "");
const mappingValue = mapping[mappingKey];
@ -39,12 +36,13 @@ EM_JS(void, load_file_async_js, (const char* fullPathC), {
} catch (err) {}
// Get the new file
FS.createPreloadedFile(path, filename, iurl, true, true, function() {
window.fileAsyncCache[fullPath] = 1;
if (window.setNotBusy) window.setNotBusy();
if (window.fileLoadedAsync) window.fileLoadedAsync(fullPath);
wakeUp();
}, console.error);
getLazyAsset(iurl, filename, () => {
FS.createPreloadedFile(path, filename, iurl, true, true, function() {
window.fileAsyncCache[fullPath] = 1;
if (window.fileLoadedAsync) window.fileLoadedAsync(fullPath);
wakeUp();
}, console.error);
});
});
});