mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-14 20:40:21 +02:00
refactor feature hooks to be conditionally initialized
This commit is contained in:
@@ -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 />;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user