Skip to content

Commit f4ba45d

Browse files
author
Daniel Schmidt
committed
Remove "removeVisible references"
1 parent 52c8f55 commit f4ba45d

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/intersection.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function observe(element, callback, threshold = 0) {
3030

3131
/**
3232
* Stop observing an element. If an element is removed from the DOM or otherwise destroyed,
33-
* make sure to call this method. This is called automatically if an element has "removeWhenVisible" set to true.
33+
* make sure to call this method.
3434
* @param element {HTMLElement}
3535
*/
3636
export function unobserve(element) {
@@ -60,12 +60,9 @@ export function unobserve(element) {
6060
function onChange(changes) {
6161
changes.forEach(intersection => {
6262
if (INSTANCE_MAP.has(intersection.target)) {
63-
const {
64-
callback,
65-
removeWhenVisible,
66-
visible,
67-
threshold,
68-
} = INSTANCE_MAP.get(intersection.target)
63+
const { callback, visible, threshold } = INSTANCE_MAP.get(
64+
intersection.target,
65+
)
6966
let inView
7067
if (typeof intersection.isIntersecting === 'boolean') {
7168
// Use the new "isIntersecting" property if available.
@@ -77,16 +74,15 @@ function onChange(changes) {
7774
: intersection.intersectionRatio >= threshold
7875
}
7976

80-
if (callback) {
81-
callback(inView)
82-
}
83-
8477
INSTANCE_MAP.set(intersection.target, {
8578
callback,
86-
removeWhenVisible,
8779
visible: inView,
8880
threshold,
8981
})
82+
83+
if (callback) {
84+
callback(inView)
85+
}
9086
}
9187
})
9288
}

0 commit comments

Comments
 (0)