Skip to content

@serenity-is/corelib / executeEverytimeWhenVisible

Function: executeEverytimeWhenVisible()

executeEverytimeWhenVisible(el, callback, callNowIfVisible): number

Defined in: src/compat/layouttimer.ts:271

Executes a callback every time the element becomes visible. Unlike executeOnceWhenVisible, the registration persists and fires on each hidden-to-visible transition.

Parameters

el

Target element or array-like collection (first element is used).

HTMLElement | ArrayLike<HTMLElement>

callback

Function

Function to invoke each time the element is shown.

callNowIfVisible

boolean

When true and the element is already visible, invokes the callback immediately before registering.

Returns

number

The LayoutTimer registration key, or null if the element is missing.

Deprecated

Prefer IntersectionObserver / ResizeObserver. Kept for legacy triggerLayoutOnShow compatibility.