@better-typed/react-window-hooks
Version:
React window hooks
15 lines (11 loc) • 716 B
TypeScript
declare type EventHandler<T extends Event = Event> = (e: T) => void;
declare type WindowEventHook = {
<K extends keyof WindowEventMap>(value: K | [K, AddEventListenerOptions], handler: EventHandler<WindowEventMap[K]>, dependencies?: any[]): void;
};
declare const useWindowEvent: WindowEventHook;
declare type WindowWidthType = number;
declare type WindowHeightType = number;
declare type UseWindowSizeType = [WindowWidthType, WindowHeightType];
declare const useWindowSize: (onResize?: ((size: UseWindowSizeType) => void) | undefined) => UseWindowSizeType;
declare const getIsClient: () => boolean;
export { UseWindowSizeType, WindowHeightType, WindowWidthType, getIsClient, useWindowEvent, useWindowSize };