Skip to content

Commit 3194ecb

Browse files
committed
pref: add throttle to IntersectionObserver
1 parent 2dddb62 commit 3194ecb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/utils/lazy-load.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ class LazyLoader {
1717
if (this.rended) return this.unobserve()
1818

1919
const entry = entries[0]
20-
21-
if (entry.intersectionRatio > 0) {
20+
const DELAY_TIME = 260
21+
if (entry.intersectionRatio >= 0) {
2222
this.timer = setTimeout(() => {
2323
this.handler()
2424
this.rended = true
25-
console.log(this.rended)
26-
}, 260)
25+
}, DELAY_TIME)
2726
} else {
2827
if (this.timer) {
2928
clearTimeout(this.timer)

0 commit comments

Comments
 (0)