@q149/angular-scrollspy
Version:
A simple lightweight library for Angular which automatically updates links to indicate the currently active section in the viewport
44 lines (43 loc) • 1.28 kB
TypeScript
import { QueryList } from '@angular/core';
import { ScrollSpyItemDirective } from '../scroll-spy-item/scroll-spy-item.directive';
import { Spy } from '../shared/spy.model';
/**
* Service that stores a list of `Spy`'s and the state
* of their nav items `inViewport` and `active` state
*
*/
export declare class ScrollSpyService {
/**
* List of `Spy`'s
*
* @memberof ScrollSpyService
*/
spys: Spy[];
/**
* Stores requests to add items to spy when spy hasn't been created
* yet. Once spy has been added then request will be made again.
*
* @memberof ScrollSpyService
*/
buffer: any[];
/**
* Add spy to list of `spys`
*
* @memberof ScrollSpyService
*/
addSpy(id: string, items: QueryList<ScrollSpyItemDirective>): void;
/**
* Remove spy from list of `spys`
*
* @memberof ScrollSpyService
*/
removeSpy(id: string): void;
/**
* Set the `inViewport` status for a spy item then sets the active
* to true for the first item in the list that has `inViewport`
* set to true
*
* @memberof ScrollSpyService
*/
setSpySectionStatus(sectionId: string, spyId: string, inViewport: boolean): void;
}