rooks
Version:
Essential React custom hooks ⚓ to super charge your components!
35 lines • 1.72 kB
TypeScript
import type { RefObject } from "react";
interface UseFullscreenProps {
target?: RefObject<Element>;
onChange?: (event: Event) => void;
onError?: (event: Event) => void;
requestFullScreenOptions?: FullscreenOptions;
}
/**
*
* useFullscreen hook
*
* Gives control to make HTML Elements fullscreen.
*
* @param {Element | undefined} props.target The target element to be fullscreen.
* @param {(event: Event) => void} props.onChange The function to be called when the fullscreen changes.
* @param {(event: Event) => void} props.onError The function to be called when the fullscreen error occurs.
* @param {FullscreenOptions} props.requestFullscreenOptions The options to be passed to the requestFullscreen function.
* @return {Object} returns - The controlls of useFullscreen hook.
* @return {boolean} returns.isFullscreenAvailable - Whether the fullscreen is available.
* @return {Element | null} returns.fullscreenElement - The fullscreen element.
* @return {boolean} returns.isFullscreenEnabled - Whether the fullscreen is enabled.
* @return {() => Promise<void>} returns.enableFullscreen - The function to enable fullscreen.
* @return {() => Promise<void>} returns.disableFullscreen - The function to disable fullscreen.
* @return {() => Promise<void>} returns.toggleFullscreen - The function to toggle fullscreen.
*/
declare function useFullscreen(props?: UseFullscreenProps): {
isFullscreenAvailable: boolean;
fullscreenElement: Element | null;
isFullscreenEnabled: boolean;
enableFullscreen: () => Promise<void>;
disableFullscreen: () => Promise<void>;
toggleFullscreen: () => Promise<void>;
};
export { useFullscreen };
//# sourceMappingURL=useFullscreen.d.ts.map