Remove mouse-back/forward listeners

- Not needed for web since the browser does it, and should have been gated under 'app'
- This reverts lbry-desktop 3744.
This commit is contained in:
infinite-persistence 2021-11-09 16:53:11 +08:00
parent f0591b8956
commit 0e2bb350c0
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -46,10 +46,6 @@ const SyncFatalError = lazyImport(() => import('component/syncFatalError' /* web
export const MAIN_WRAPPER_CLASS = 'main-wrapper';
export const IS_MAC = navigator.userAgent.indexOf('Mac OS X') !== -1;
// button numbers pulled from https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
const MOUSE_BACK_BTN = 3;
const MOUSE_FORWARD_BTN = 4;
const imaLibraryPath = 'https://imasdk.googleapis.com/js/sdkloader/ima3.js';
type Props = {
@ -58,13 +54,7 @@ type Props = {
theme: string,
user: ?{ id: string, has_verified_email: boolean, is_reward_approved: boolean },
location: { pathname: string, hash: string, search: string },
history: {
goBack: () => void,
goForward: () => void,
index: number,
length: number,
push: (string) => void,
},
history: { push: (string) => void },
fetchAccessToken: () => void,
fetchChannelListMine: () => void,
fetchCollectionListMine: () => void,
@ -196,22 +186,6 @@ function App(props: Props) {
return () => window.removeEventListener('beforeunload', handleBeforeUnload);
}, [uploadCount]);
// allows user to navigate history using the forward and backward buttons on a mouse
useEffect(() => {
const handleForwardAndBackButtons = (e) => {
switch (e.button) {
case MOUSE_BACK_BTN:
history.index > 0 && history.goBack();
break;
case MOUSE_FORWARD_BTN:
history.index < history.length - 1 && history.goForward();
break;
}
};
window.addEventListener('mouseup', handleForwardAndBackButtons);
return () => window.removeEventListener('mouseup', handleForwardAndBackButtons);
});
// allows user to pause miniplayer using the spacebar without the page scrolling down
useEffect(() => {
const handleKeyPress = (e) => {