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
Copy file name to clipboardExpand all lines: packages/core/src/bundle/hooks/useIntersectionObserver/useIntersectionObserver.js
+28-5Lines changed: 28 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ import { useRefState } from '../useRefState/useRefState';
12
12
* @param {HookTarget} target The target element to detect intersection
13
13
* @param {boolean} [options.enabled=true] The IntersectionObserver options
14
14
* @param {((entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void) | undefined} [options.onChange] The callback to execute when intersection is detected
15
-
* @param {HookTarget} [options.root] The root element to observe
15
+
* @param {HookTarget} [options.root=document] The root element to observe
16
16
* @returns {UseIntersectionObserverReturn} An object containing the state
17
17
*
18
18
* @example
@@ -22,20 +22,43 @@ import { useRefState } from '../useRefState/useRefState';
22
22
* @template Target The target element
23
23
* @param {boolean} [options.enabled=true] The IntersectionObserver options
24
24
* @param {((entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void) | undefined} [options.onChange] The callback to execute when intersection is detected
25
-
* @param {HookTarget} [options.root] The root element to observe
25
+
* @param {HookTarget} [options.root=document] The root element to observe
26
26
* @returns {UseIntersectionObserverReturn & { ref: StateRef<Target> }} A React ref to attach to the target element
* @param {HookTarget} target The target element to detect intersection
42
52
* @param {boolean} [options.enabled=true] The IntersectionObserver options
43
53
* @param {((entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void) | undefined} [options.onChange] The callback to execute when intersection is detected
44
-
* @param {HookTarget} [options.root] The root element to observe
54
+
* @param {HookTarget} [options.root=document] The root element to observe
45
55
* @returns {UseIntersectionObserverReturn} An object containing the state
* @param {boolean} [options.enabled=true] The IntersectionObserver options
53
63
* @param {((entries: IntersectionObserverEntry[], observer: IntersectionObserver) => void) | undefined} [options.onChange] The callback to execute when intersection is detected
54
-
* @param {HookTarget} [options.root] The root element to observe
64
+
* @param {HookTarget} [options.root=document] The root element to observe
55
65
* @returns {UseIntersectionObserverReturn & { ref: StateRef<Target> }} A React ref to attach to the target element
0 commit comments