azure-devops-ui
Version:
React components for building web UI in Azure DevOps
52 lines (51 loc) • 2.05 kB
TypeScript
import "../../CommonImports";
import "../../Core/core.css";
import * as React from "react";
import { IIntersectionProps } from "./Intersection.Props";
export interface IIntersectionContext {
readonly rootMargin: number;
readonly root: HTMLElement;
observe: (element: HTMLElement) => void;
register: (callback: IntersectionObserverCallback) => void;
unobserve: (element: HTMLElement) => void;
unregister: (callback: IntersectionObserverCallback) => void;
}
declare class IntersectionContextImpl implements IIntersectionContext {
private callbacks;
private callbacksSet;
private observer?;
private pending;
private pendingSet;
private scrollThrottleId;
private lastScrollTime;
private static readonly SCROLL_THROTTLE_MS;
rootMargin: number;
root: HTMLElement;
private ENABLE_INTERSECTION_PERF_OPTIMIZATIONS;
get performanceOptimizationsEnabled(): boolean;
connect(root: HTMLElement, rootMargin?: number, threshold?: number[]): void;
disconnect(): void;
observe(element: HTMLElement): void;
onIntersect: (entries: IntersectionObserverEntry[]) => void;
onScrollThrottled: () => void;
register(callback: IntersectionObserverCallback): void;
unobserve(element: HTMLElement): void;
unregister(callback: IntersectionObserverCallback): void;
}
export declare const IntersectionContext: React.Context<IIntersectionContext>;
/**
* The Intersection is used to observe the changes of visibility in the children
* of the rootElement. It also will notify the caller when the rootElement is
* scrolled. It will pass an empty array of entries in the scorlling case.
*/
export declare class Intersection extends React.Component<IIntersectionProps, IIntersectionContext> {
private externalElement;
private mergedRef;
private rootElement;
state: IntersectionContextImpl;
render(): JSX.Element;
componentDidMount(): void;
componentWillUnmount(): void;
private onScroll;
}
export {};