Try to speed up LCP allSettled

This commit is contained in:
schlagmichdoch 2024-06-06 02:00:33 +02:00
parent 924c17323d
commit fcb854a000
2 changed files with 5 additions and 5 deletions

View file

@ -40,21 +40,21 @@ class PairDrop {
this.footerUI = new FooterUI(); this.footerUI = new FooterUI();
// Translate page, initiate database, and evaluate what to show // Translate page, initiate database, and evaluate what to show
await Promise.all([ await Promise.allSettled([
PersistentStorage.initiate(), PersistentStorage.initiate(),
Localization.initiate(), Localization.initiate(),
this.evaluatePermissionsAndRoomSecrets() this.evaluatePermissionsAndRoomSecrets()
]); ]);
// Evaluate css shifting UI elements and show loading placeholder // Evaluate css shifting UI elements and show loading placeholder
await Promise.all([ await Promise.allSettled([
this.headerUI.evaluateOverflowing(), this.headerUI.evaluateOverflowing(),
this.footerUI._evaluateFooterBadges(), this.footerUI._evaluateFooterBadges(),
this.footerUI.showLoading() this.footerUI.showLoading()
]); ]);
// Fade in UI elements // Fade in UI elements
await Promise.all([ await Promise.allSettled([
this.headerUI.fadeIn(), this.headerUI.fadeIn(),
this.footerUI.fadeIn(), this.footerUI.fadeIn(),
this.centerUI.fadeIn(), this.centerUI.fadeIn(),
@ -111,7 +111,7 @@ class PairDrop {
async loadDeferredAssets() { async loadDeferredAssets() {
const stylePromises = this.stylesDeferred.map(url => this.loadAndApplyStylesheet(url)); const stylePromises = this.stylesDeferred.map(url => this.loadAndApplyStylesheet(url));
const scriptPromises = this.scriptsDeferred.map(url => this.loadAndApplyScript(url)); const scriptPromises = this.scriptsDeferred.map(url => this.loadAndApplyScript(url));
await Promise.all([...stylePromises, ...scriptPromises]); await Promise.allSettled([...stylePromises, ...scriptPromises]);
} }
loadStyleSheet(url) { loadStyleSheet(url) {

View file

@ -156,7 +156,7 @@ self.addEventListener('activate', evt => {
return evt.waitUntil( return evt.waitUntil(
caches.keys() caches.keys()
.then(cacheNames => { .then(cacheNames => {
return Promise.all( return Promise.allSettled(
cacheNames.map(cacheName => { cacheNames.map(cacheName => {
if (cacheName !== cacheTitle) { if (cacheName !== cacheTitle) {
return caches.delete(cacheName); return caches.delete(cacheName);