Skip to content

Instantly share code, notes, and snippets.

@bob-lee
Last active November 2, 2018 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bob-lee/a14375362f97b4bbbd2e6c4363c2fc0c to your computer and use it in GitHub Desktop.
Save bob-lee/a14375362f97b4bbbd2e6c4363c2fc0c to your computer and use it in GitHub Desktop.
export class LazyLoadService {
// ...
private _loadAheadCount = 2; // default 2
get loadAheadCount() { return this._loadAheadCount; }
set loadAheadCount(value: number) {
this._loadAheadCount = value;
}
// announce intersecting index to [lazyLoad] directives
private intersection$ = new Subject<any>();
announcedIntersection = this.intersection$.asObservable();
announceIntersection(params: object) { // { index: number, state: IntersectionState }
this.intersection$.next(params);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment