UNPKG

ngx-intersection-observer

Version:
81 lines (80 loc) 3.3 kB
import { ElementRef, EventEmitter, OnDestroy, OnInit, Renderer2 } from "@angular/core"; import { IntersectionObserverConfig } from "./intersection-observer-config.model"; import { IntersectionObserverEvent } from "./intersection-observer-event.model"; import { IntersectionObserverService } from "./intersection-observer.service"; import * as i0 from "@angular/core"; export declare class IntersectionObserverDirective implements OnInit, OnDestroy { private element; private renderer; private intersectionObserverService; private intersectionObserverConfig?; private _viewportChangeSub; private _visitClass; private _leaveClass; private _removeVisitClass; private _removeLeaveClass; private _elementVisible; private _hasClasses; visitClass: string | undefined; leaveClass: string | undefined; removeVisitClass: string | undefined; removeLeaveClass: string | undefined; useScroll: boolean | undefined; threshold: number | undefined; autoRemove: boolean | undefined; intersection: EventEmitter<IntersectionObserverEvent>; constructor(element: ElementRef<any>, renderer: Renderer2, intersectionObserverService: IntersectionObserverService, intersectionObserverConfig?: IntersectionObserverConfig | undefined); ngOnInit(): void; /** * Gets an array of classes. * @param classString String with classes separated by whitespace. * @returns An array with classes. */ private getClassArray; /** * Checks if the element is visible within the viewport. * @returns void * */ private checkForIntersection; /** * * @param intersect Determines if the elements intersects with its viewport or not. * @returns void */ private handleIntersection; /** * Adds or removes classes on the element when it enters or leaves the viewport. * @returns void * */ private handleClasses; /** * Helper to add a list of classes to the element. * @param classes The list of classes to add. * @returns void */ private addClasses; /** * Helper to remove a list of classes from the element. * @param classes The list of classes to remove. * @returns void */ private removeClasses; /** * Gets the height of the browser window. * @returns the height of the browser window. */ private get winHeight(); /** * Gets the offset of the element. * @returns The elements offset. */ private get offsetTop(); /** * Gets the height of the element (Including border) * @returns the height of the element. */ private get elementHeight(); ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<IntersectionObserverDirective, [null, null, null, { optional: true; }]>; static ɵdir: i0.ɵɵDirectiveDeclaration<IntersectionObserverDirective, "[intersectionObserver]", never, { "visitClass": "visitClass"; "leaveClass": "leaveClass"; "removeVisitClass": "removeVisitClass"; "removeLeaveClass": "removeLeaveClass"; "useScroll": "useScroll"; "threshold": "threshold"; "autoRemove": "autoRemove"; }, { "intersection": "intersection"; }, never, never, false>; }