refactor feature hooks to be conditionally initialized

This commit is contained in:
jeffvli
2026-01-21 02:23:25 -08:00
parent 9a4a8eb742
commit f4072c183b
12 changed files with 236 additions and 35 deletions
@@ -150,3 +150,19 @@ export const useMainPlayerListener = () => {
toggleShuffle,
]);
};
const MainPlayerListenerHookInner = () => {
useMainPlayerListener();
return null;
};
export const MainPlayerListenerHook = () => {
const isElectronEnv = isElectron();
const mpvPlayerListener = isElectronEnv ? window.api.mpvPlayerListener : null;
if (mpvPlayerListener === null) {
return null;
}
return <MainPlayerListenerHookInner />;
};