You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However this api is not supported in some browsers (ref), i suggest to use it not instead of current implementation, but as an addition. In example, we can provide configuration options to imported module, where we can set preferred detection mechanism.
Usage
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { LazyLoadImageModule, LazyLoadImageOptions, LazyLoadMode } from 'ng-lazyload-image';
import { AppComponent } from './app.component';
const options: LazyLoadImageOptions = {
preferredMode: LazyLoadMode.SCROLL_OBSERVER // or LazyLoadMode.INTERSECTION_OBSERVER
}
@NgModule({
declarations: [ AppComponent ],
imports: [ BrowserModule, LazyLoadImageModule ],
bootstrap: [ AppComponent ]
})
export class MyAppModule {}
In condition if user set LazyLoadMode.INTERSECTION_OBSERVER (which mean what he want use intersection api) and browser will not support this api we will use standart scroll observer (LazyLoadMode.SCROLL_OBSERVER).
Why
Intersection api is more fast, give a more performance and take responsibility to calculate check if the element is in the viewport.
The text was updated successfully, but these errors were encountered:
Idea
Propose to use new browser api - IntersectionObserver
However this api is not supported in some browsers (ref), i suggest to use it not instead of current implementation, but as an addition. In example, we can provide configuration options to imported module, where we can set preferred detection mechanism.
Usage
In condition if user set
LazyLoadMode.INTERSECTION_OBSERVER
(which mean what he want use intersection api) and browser will not support this api we will use standart scroll observer (LazyLoadMode.SCROLL_OBSERVER
).Why
Intersection api is more fast, give a more performance and take responsibility to calculate check if the element is in the viewport.
The text was updated successfully, but these errors were encountered: