Skip to content

Commit

Permalink
implement debouncing
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajgupta36 committed May 26, 2024
1 parent 537be0d commit b83945b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/videothumbnail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,16 @@ const VideoThumbnail = ({
setVideoUrl(null);
};
}, [contentId]);

let hoverTimeout: any;
const handleMouseEnter = () => {
hoverTimeout = setTimeout(() => {
setHover(true);
}, 500);
setHover(true);
};

const handleMouseLeave = () => {
clearTimeout(hoverTimeout);
setHover(false);
};
const handlePlayerReady = async (player: Player) => {
Expand Down

0 comments on commit b83945b

Please sign in to comment.