createIntersection(
config
?):object
Create an intersection service.
The returned service includes the patch method to set the elements to observe / intersection options and the states to track the visible elements.
• config?: PropsConfig
<IntersectionProps
>
the props config for the intersection service
object
the intersection service
elements$:
ReadableSignal
<HTMLElement
[]>
Readable of observed elements
patch: <
U
>(storesValues
?) =>void
• U extends Partial
<IntersectionProps
>
• storesValues?: void
| U
void
visibleElements$:
ReadableSignal
<Map
<Element
,IntersectionObserverEntry
>>
Store of map that contains the visible elements (for the key) and the corresponding entries
See the MDN documentation
elements:
HTMLElement
[]
elements to observe
options:
undefined
|Partial
<IntersectionObserverInit
>
IntersectionObserverInit used in the IntersectionObserver
See the MDN documentation