Added minimal polyfill for IntersectionObserver
This commit is contained in:
parent
b6c4968c6c
commit
49a6d8b7fa
@ -9,6 +9,9 @@ export class AnimeNotifier {
|
||||
|
||||
constructor(app: Application) {
|
||||
this.app = app
|
||||
|
||||
if("IntersectionObserver" in window) {
|
||||
// Enable lazy load
|
||||
this.visibilityObserver = new IntersectionObserver(
|
||||
entries => {
|
||||
for(let entry of entries) {
|
||||
@ -20,6 +23,16 @@ export class AnimeNotifier {
|
||||
},
|
||||
{}
|
||||
)
|
||||
} else {
|
||||
// Disable lazy load feature
|
||||
this.visibilityObserver = {
|
||||
disconnect: () => {},
|
||||
observe: (elem: HTMLElement) => {
|
||||
elem["became visible"]()
|
||||
},
|
||||
unobserve: (elem: HTMLElement) => {}
|
||||
} as IntersectionObserver
|
||||
}
|
||||
}
|
||||
|
||||
onReadyStateChange() {
|
||||
|
Loading…
Reference in New Issue
Block a user