@tanstack/vue-router
Version:
Modern and scalable routing for Vue applications
41 lines (40 loc) • 1.59 kB
TypeScript
import * as Vue from 'vue';
export declare const useLayoutEffect: typeof Vue.effect;
export declare const usePrevious: (fn: () => boolean) => Vue.ComputedRef<{
current: boolean | null;
previous: boolean | null;
}>;
/**
* React hook to wrap `IntersectionObserver`.
*
* This hook will create an `IntersectionObserver` and observe the ref passed to it.
*
* When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.
*
* @param ref - The ref to observe
* @param intersectionObserverOptions - The options to pass to the IntersectionObserver
* @param options - The options to pass to the hook
* @param callback - The callback to call when the intersection changes
* @returns The IntersectionObserver instance
* @example
* ```tsx
* const MyComponent = () => {
* const ref = React.useRef<HTMLDivElement>(null)
* useIntersectionObserver(
* ref,
* (entry) => { doSomething(entry) },
* { rootMargin: '10px' },
* { disabled: false }
* )
* return <div ref={ref} />
* ```
*/
export declare function useIntersectionObserver<T extends Element>(ref: Vue.Ref<T | null>, callback: (entry: IntersectionObserverEntry | undefined) => void, intersectionObserverOptions?: IntersectionObserverInit, options?: {
disabled?: boolean | (() => boolean);
}): Vue.Ref<IntersectionObserver | null>;
export declare function splitProps<T extends Record<string, any>>(props: T, keys: Array<keyof T>): Vue.ComputedRef<{
[k: string]: unknown;
}>[];
export type ParentProps<T = {}> = T & {
children?: Vue.VNode | Array<Vue.VNode> | string;
};