react-chrono
Version:
A Modern Timeline component for React
24 lines (23 loc) • 1.13 kB
TypeScript
import { RefObject } from 'react';
type SlideshowHookReturn = {
paused: boolean;
remainInterval: number;
setStartWidth: (width: number) => void;
setupTimer: (interval: number) => void;
startWidth: number;
tryPause: () => void;
tryResume: () => void;
};
/**
* Custom hook to manage slideshow functionality with pause/resume capabilities
* Uses requestAnimationFrame for smoother animation performance
* @param ref - Reference to the HTML element containing the slideshow
* @param active - Whether the current slide is active
* @param slideShowActive - Whether the slideshow functionality is enabled
* @param slideItemDuration - Duration in milliseconds for each slide
* @param id - Unique identifier for the current slide
* @param onElapsed - Callback function triggered when slide duration elapses
* @returns Object containing slideshow control functions and state
*/
declare const useSlideshow: (ref: RefObject<HTMLElement>, active: boolean, slideShowActive: boolean, slideItemDuration: number, id: string, onElapsed?: (id: string) => void) => SlideshowHookReturn;
export { useSlideshow };