Reduce Scripts needed on start up to reduce critical requests aka speed up initial loading

This commit is contained in:
schlagmichdoch 2023-11-11 19:56:23 +01:00
parent bdc8a6b111
commit 00e7394740
6 changed files with 124 additions and 111 deletions

View file

@ -7,17 +7,19 @@ class PairDrop {
this.$headerNotificationButton = $('notification');
this.$editPairedDevicesHeaderBtn = $('edit-paired-devices');
this.$footerInstructionsPairedDevices = $$('.discovery-wrapper .badge-room-secret');
this.$head = $$('head');
this.$installBtn = $('install');
this.registerServiceWorker();
Events.on('beforeinstallprompt', e => this.onPwaInstallable(e));
const persistentStorage = new PersistentStorage();
const themeUI = new ThemeUI();
const backgroundCanvas = new BackgroundCanvas();
Events.on('initial-translation-loaded', _ => {
const backgroundCanvas = new BackgroundCanvas();
// FooterUI needs translations
const footerUI = new FooterUI();
Events.on('fade-in-ui', _ => this.fadeInUI())
@ -29,6 +31,9 @@ class PairDrop {
// Load deferred assets
this.loadDeferredAssets();
});
// Translate page -> fires 'initial-translation-loaded' on finish
const localization = new Localization();
}
registerServiceWorker() {
@ -171,6 +176,4 @@ class PairDrop {
}
}
const persistentStorage = new PersistentStorage();
const pairDrop = new PairDrop();
const localization = new Localization();
const pairDrop = new PairDrop();