mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
feat: code splitting (#3593)
Co-authored-by: Angelos Bouklis <me@arjix.dev>
This commit is contained in:
@ -45,7 +45,7 @@ export const onPlayerApiReady = async (
|
||||
}, 2500);
|
||||
|
||||
/** Restore saved volume and setup tooltip */
|
||||
function firstRun() {
|
||||
async function firstRun() {
|
||||
if (typeof options.savedVolume === 'number') {
|
||||
// Set saved volume as tooltip
|
||||
setTooltip(options.savedVolume);
|
||||
@ -66,7 +66,7 @@ export const onPlayerApiReady = async (
|
||||
injectVolumeHud(noVid);
|
||||
if (!noVid) {
|
||||
setupVideoPlayerOnwheel();
|
||||
if (!window.mainConfig.plugins.isEnabled('video-toggle')) {
|
||||
if (!await window.mainConfig.plugins.isEnabled('video-toggle')) {
|
||||
// Video-toggle handles hud positioning on its own
|
||||
const videoMode = () =>
|
||||
api.getPlayerResponse().videoDetails?.musicVideoType !==
|
||||
@ -280,7 +280,7 @@ export const onPlayerApiReady = async (
|
||||
);
|
||||
context.ipc.on('setVolume', (value: number) => setVolume(value));
|
||||
|
||||
firstRun();
|
||||
await firstRun();
|
||||
};
|
||||
|
||||
export const onConfigChange = (config: PreciseVolumePluginConfig) => {
|
||||
|
||||
@ -309,8 +309,8 @@ function registerMPRIS(win: BrowserWindow) {
|
||||
player.volume = Number.parseFloat((newVol / 100).toFixed(2));
|
||||
});
|
||||
|
||||
player.on('volume', (newVolume: number) => {
|
||||
if (config.plugins.isEnabled('precise-volume')) {
|
||||
player.on('volume', async (newVolume: number) => {
|
||||
if (await config.plugins.isEnabled('precise-volume')) {
|
||||
// With precise volume we can set the volume to the exact value.
|
||||
win.webContents.send('setVolume', ~~(newVolume * 100));
|
||||
} else {
|
||||
|
||||
@ -159,9 +159,9 @@ export default createPlugin({
|
||||
const config = await getConfig();
|
||||
this.config = config;
|
||||
|
||||
const moveVolumeHud = window.mainConfig.plugins.isEnabled(
|
||||
const moveVolumeHud = (await window.mainConfig.plugins.isEnabled(
|
||||
'precise-volume',
|
||||
)
|
||||
))
|
||||
? (preciseVolumeMoveVolumeHud as (_: boolean) => void)
|
||||
: () => {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user