From e356e2787cc31dae19d68e83fc62a6d63f1ed295 Mon Sep 17 00:00:00 2001 From: GooseOb Date: Wed, 11 Dec 2024 22:00:54 +0100 Subject: [PATCH] make applying settings and menu initialization parallel --- package.json | 2 +- src/listeners/on-video-page.ts | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 11e7f23..b65dfb6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "yt-defaulter", "author": "GooseOb", - "version": "1.11.8", + "version": "1.11.9", "repository": { "type": "git", "url": "git+https://github.com/GooseOb/YT-Defaulter.git" diff --git a/src/listeners/on-video-page.ts b/src/listeners/on-video-page.ts index 5e12af2..9a4748a 100644 --- a/src/listeners/on-video-page.ts +++ b/src/listeners/on-video-page.ts @@ -7,21 +7,24 @@ import * as menu from '../menu'; export const onVideoPage = async () => { const aboveTheFold = await untilAppear(get.aboveTheFold); + config.channel.username = (await untilAppear(get.channelUsernameElementGetter(aboveTheFold))).href || ''; - await plr.set(await untilAppear(get.plr)); - - const doNotChangeSpeed = - config.value.flags.standardMusicSpeed && - !!get.artistChannelBadge(aboveTheFold); + untilAppear(get.plr) + .then((plrElement) => plr.set(plrElement)) + .then(() => { + const doNotChangeSpeed = + config.value.flags.standardMusicSpeed && + !!get.artistChannelBadge(aboveTheFold); - applySettings(computeSettings(doNotChangeSpeed)); + applySettings(computeSettings(doNotChangeSpeed)); + }); if (menu.value.element) { menu.controls.updateThisChannel(config.channel.get()); } else { - await menu.init(); + menu.init(); } };