mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-24 04:47:46 +00:00
event handler function names fixed
This commit is contained in:
parent
e6eb49fe7f
commit
042f2f3fcb
2 changed files with 7 additions and 7 deletions
|
|
@ -3,12 +3,12 @@ const React = require('react');
|
|||
const useLocationHash = () => {
|
||||
const [locationHash, setLocationHash] = React.useState(window.location.hash);
|
||||
React.useEffect(() => {
|
||||
const onLocationHashChanged = () => {
|
||||
const onLocationHashChange = () => {
|
||||
setLocationHash(window.location.hash);
|
||||
};
|
||||
window.addEventListener('hashchange', onLocationHashChanged);
|
||||
window.addEventListener('hashchange', onLocationHashChange);
|
||||
return () => {
|
||||
window.removeEventListener('hashchange', onLocationHashChanged);
|
||||
window.removeEventListener('hashchange', onLocationHashChange);
|
||||
};
|
||||
}, []);
|
||||
return locationHash;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ const Router = ({ onPathNotMatch, ...props }) => {
|
|||
}
|
||||
}, []);
|
||||
React.useEffect(() => {
|
||||
const onLocationHashChanged = () => {
|
||||
const onLocationHashChange = () => {
|
||||
const { pathname, query } = UrlUtils.parse(window.location.hash.slice(1));
|
||||
const routeConfig = routeConfigForPath(viewsConfig, pathname);
|
||||
if (!routeConfig) {
|
||||
|
|
@ -72,10 +72,10 @@ const Router = ({ onPathNotMatch, ...props }) => {
|
|||
});
|
||||
});
|
||||
};
|
||||
window.addEventListener('hashchange', onLocationHashChanged);
|
||||
onLocationHashChanged();
|
||||
window.addEventListener('hashchange', onLocationHashChange);
|
||||
onLocationHashChange();
|
||||
return () => {
|
||||
window.removeEventListener('hashchange', onLocationHashChanged);
|
||||
window.removeEventListener('hashchange', onLocationHashChange);
|
||||
};
|
||||
}, [onPathNotMatch]);
|
||||
return (
|
||||
|
|
|
|||
Loading…
Reference in a new issue