@avtest/ng-spy
Version:
A lightweight, dependency-free scrollspy for angular. Use this library to spy on HTML elements on your page when the window is scrolled or resized.
36 lines (35 loc) • 1.33 kB
TypeScript
import { ElementRef } from '@angular/core';
import { Observable } from 'rxjs';
import { SpyTarget } from './spy-target.model';
import { WindowService } from './window.service';
import * as i0 from "@angular/core";
export declare class ScrollSpyService {
private windowService;
private stopSpying$;
private activeSpyTarget$;
private scrollEvent;
private resizeEvent;
private spyTargets;
private thresholdTop;
private thresholdBottom;
private scrollContainer;
private isSpying;
constructor(windowService: WindowService);
spy({ scrollContainer, thresholdTop, thresholdBottom }?: SpyOptions): void;
addTarget(target: SpyTarget): void;
removeTarget(target: string): void;
checkActiveElement(scrollContainer?: ElementRef): void;
isElementActive(element: ElementRef, scrollContainer?: ElementRef, scrollContainerOffset?: number, currentActiveElement?: ElementRef): boolean;
private getTotalOffset;
private isElementInsideWindow;
get activeSpyTarget(): Observable<string>;
stopSpying(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ScrollSpyService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ScrollSpyService>;
}
interface SpyOptions {
scrollContainer?: ElementRef;
thresholdTop?: number;
thresholdBottom?: number;
}
export {};