This repository has been archived on 2025-07-07. You can view files and clone it, but cannot push or open issues or pull requests.
Files
2025-01-11 09:54:09 +03:00

17 lines
562 B
TypeScript

type Measurable = {
getBoundingClientRect(): ClientRect;
};
/**
* Observes an element's rectangle on screen (getBoundingClientRect)
* This is useful to track elements on the screen and attach other elements
* that might be in different layers, etc.
*/
declare function observeElementRect(
/** The element whose rect to observe */
elementToObserve: Measurable,
/** The callback which will be called when the rect changes */
callback: CallbackFn): () => void;
type CallbackFn = (rect: ClientRect) => void;
export { type Measurable, observeElementRect };