@tempots/ui

WhenInViewport() function

Executes the provided then function when the element is in the viewport. Optionally, executes the otherwise function when the element is not in the viewport.

Signature:

WhenInViewport: (mode: InViewportMode, then: TNode, otherwise?: TNode) => Renderable

Parameters

Parameter

Type

Description

mode

InViewportMode

The mode to determine when the element is considered in the viewport.

then

TNode

The function to execute when the element is in the viewport.

otherwise

TNode

(Optional) The function to execute when the element is not in the viewport.

Returns: Renderable

The result of executing the then function or the otherwise function.