UNPKG

@ynmstudio/utils

Version:
39 lines (38 loc) 1.63 kB
import { ElementRef, EventEmitter, OnDestroy, AfterViewInit, OnInit, InjectionToken } from '@angular/core'; import * as i0 from "@angular/core"; export 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> * ``` */ export 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>; }