UNPKG

@ynmstudio/utils

Version:
42 lines (39 loc) 1.68 kB
import * as i0 from '@angular/core'; import { InjectionToken, AfterViewInit, OnDestroy, OnInit, EventEmitter, ElementRef } from '@angular/core'; declare const INTERSECTION_OBSERVER_INIT: InjectionToken<IntersectionObserverInit>; /** * A simple lightweight library for Angular with that detects when an * element is within the browsers viewport and adds a `in-viewport` or * `not-in-viewport` class to the element. * * @example * ```html * <p * class="foo" * snInViewport * (inViewportChange)="myEventHandler($event)"> * Amet tempor excepteur occaecat nulla. * </p> * ``` */ declare class InViewportDirective implements AfterViewInit, OnDestroy, OnInit { private readonly document; private platformId; private el; private inViewport; private hasIntersectionObserver; inViewportOptions?: IntersectionObserverInit; inViewportChange: EventEmitter<boolean>; observer?: IntersectionObserver; get isInViewport(): boolean; get isNotInViewport(): boolean; constructor(document: Document, platformId: Object, el: ElementRef); ngOnInit(): void; ngAfterViewInit(): void; ngOnDestroy(): void; intersectionObserverCallback(entries: IntersectionObserverEntry[]): void; private intersectionObserverFeatureDetection; static ɵfac: i0.ɵɵFactoryDeclaration<InViewportDirective, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<InViewportDirective, "[snInViewport]", ["snInViewport"], { "inViewportOptions": { "alias": "inViewportOptions"; "required": false; }; }, { "inViewportChange": "inViewportChange"; }, never, never, true, never>; } export { INTERSECTION_OBSERVER_INIT, InViewportDirective };