@atlaskit/renderer
Version:
Renderer component
28 lines (27 loc) • 965 B
TypeScript
export interface UseStableScrollOptions {
/**
* Maximum time (in ms) to wait for stability before scrolling anyway
* @default 10000
*/
maxStabilityWaitTime?: number;
/**
* Time to wait (in ms) after the last resize event before considering the layout stable
* @default 200
*/
stabilityWaitTime?: number;
}
export interface UseStableScrollReturn {
/**
* Cleans up all timers and observers
*/
cleanup: () => void;
/**
* Starts monitoring the container for stability and calls the callback when stable
*/
waitForStability: (container: HTMLElement, onStable: () => void) => void;
}
/**
* Hook that provides functionality to wait for layout stability before performing an action.
* Uses ResizeObserver to detect when a container has stopped resizing (e.g., images finished loading).
*/
export declare const useStableScroll: (options?: UseStableScrollOptions) => UseStableScrollReturn;