-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be nice to have an option to debounce #456
Comments
I agree. I will take a look. |
This should be possible in the upcoming version import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { debounceTime } from 'rxjs/operators';
import { LazyLoadImageModule, IntersectionObserverHooks, Attributes } from 'ng-lazyload-image';
import { AppComponent } from './app.component';
class LazyLoadImageHooks extends IntersectionObserverHooks {
getObservable(attributes: Attributes) {
return super.getObservable(attributes).pipe(debounceTime(1000))
}
}
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, LazyLoadImageModule.forRoot(LazyLoadImageHooks)],
bootstrap: [AppComponent],
})
export class MyAppModule {} Let me know if something is unclear or if it doesn't work for you. The plan is to leave the beta channel in a couple of days. |
I have created a sandbox here where you can try it out: https://codesandbox.io/s/lazy-load-image-with-httpclient-to538?file=/src/app/app.module.ts Scroll down fast and then slowly up |
Version 8.0.0 is now out. |
My use case is a fast scroll from top to bottom.
It would be nice to skip loading all the images in between.
Thanks.
The text was updated successfully, but these errors were encountered: