1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Move event type to enum

This commit is contained in:
Bill Thornton 2024-05-16 12:34:41 -04:00
parent 32a91eabf1
commit 1a172bdb1b
3 changed files with 12 additions and 7 deletions

View file

@ -6,7 +6,7 @@ import RemotePlayButton from 'apps/experimental/components/AppToolbar/RemotePlay
import SyncPlayButton from 'apps/experimental/components/AppToolbar/SyncPlayButton';
import AppToolbar from 'components/toolbar/AppToolbar';
import ViewManagerPage from 'components/viewManager/ViewManagerPage';
import { SHOW_OSD_EVENT } from 'controllers/playback/video';
import { EventType } from 'types/eventType';
import Events, { type Event } from 'utils/events';
/**
@ -23,10 +23,10 @@ const VideoPage: FC = () => {
useEffect(() => {
const doc = documentRef.current;
if (doc) Events.on(doc, SHOW_OSD_EVENT, onShowVideoOsd);
if (doc) Events.on(doc, EventType.SHOW_VIDEO_OSD, onShowVideoOsd);
return () => {
if (doc) Events.off(doc, SHOW_OSD_EVENT, onShowVideoOsd);
if (doc) Events.off(doc, EventType.SHOW_VIDEO_OSD, onShowVideoOsd);
};
}, []);

View file

@ -28,12 +28,11 @@ import LibraryMenu from '../../../scripts/libraryMenu';
import { setBackdropTransparency, TRANSPARENCY_LEVEL } from '../../../components/backdrop/backdrop';
import { pluginManager } from '../../../components/pluginManager';
import { PluginType } from '../../../types/plugin.ts';
import { EventType } from 'types/eventType';
const TICKS_PER_MINUTE = 600000000;
const TICKS_PER_SECOND = 10000000;
export const SHOW_OSD_EVENT = 'showVideoOsd';
function getOpenedDialog() {
return document.querySelector('.dialogContainer .dialog.opened');
}
@ -282,14 +281,14 @@ export default function (view) {
let mouseIsDown = false;
function showOsd(focusElement) {
Events.trigger(document, SHOW_OSD_EVENT, [ true ]);
Events.trigger(document, EventType.SHOW_VIDEO_OSD, [ true ]);
slideDownToShow(headerElement);
showMainOsdControls(focusElement);
resetIdle();
}
function hideOsd() {
Events.trigger(document, SHOW_OSD_EVENT, [ false ]);
Events.trigger(document, EventType.SHOW_VIDEO_OSD, [ false ]);
slideUpToHide(headerElement);
hideMainOsdControls();
mouseManager.hideCursor();

6
src/types/eventType.ts Normal file
View file

@ -0,0 +1,6 @@
/**
* Custom event types.
*/
export enum EventType {
SHOW_VIDEO_OSD = 'SHOW_VIDEO_OSD'
}