intersect.svelte.ts

view source

Declarations
#

7 declarations

DisconnectState
#

intersect.svelte.ts view source

DisconnectState import type {DisconnectState} from '@fuzdev/fuz_ui/intersect.svelte.js';

intersecting

type boolean

intersections

type number

el

type HTMLElement | SVGElement

observer

type IntersectionObserver

intersect
#

intersect.svelte.ts view source

(get_params: () => IntersectParamsOrCallback | null | undefined): Attachment<HTMLElement | SVGElement> import {intersect} from '@fuzdev/fuz_ui/intersect.svelte.js';

Creates an attachment that observes element viewport intersection. Uses the lazy function pattern to optimize reactivity: callbacks can update without recreating the observer, preserving state.

get_params

function that returns callback, params object, or nullish to disable

type () => IntersectParamsOrCallback | null | undefined

returns

Attachment<HTMLElement | SVGElement>

IntersectParams
#

intersect.svelte.ts view source

IntersectParams import type {IntersectParams} from '@fuzdev/fuz_ui/intersect.svelte.js';

onintersect?

Called when the element enters or leaves the viewport until disconnected.

type (state: IntersectState): void

state

returns void

ondisconnect?

Called when the attachment's observer is disconnected, either by the user calling disconnect or the attachment being destroyed.

type (state: DisconnectState): void

state

returns void

count?

A value of 1 disconnects after el enters and leaves the viewport one time, similar to 'once' for an event. 0 disables and undefined or a negative number like -1 never disconnects.

type number

options?

Same as the options param to IntersectionObserver

type IntersectionObserverInit

IntersectParamsOrCallback
#

IntersectState
#

intersect.svelte.ts view source

IntersectState import type {IntersectState} from '@fuzdev/fuz_ui/intersect.svelte.js';

intersecting

type boolean

intersections

type number

el

type HTMLElement | SVGElement

observer

type IntersectionObserver

disconnect

type (): void

returns void

OnDisconnect
#

OnIntersect
#

Imported by
#