VisibilitySensor
Description
A component that fires an action when it scrolls into the viewport. Useful for triggering lazy loading, telemetry, infinite-scroll pagination, or any "do once when visible" behaviour. By default the callback fires only once; set singleCall: false to receive every visibility transition.
Usage
API reference
public class VisibilitySensor : IComponentA VisibilitySensor component that triggers an action when it becomes visible in the viewport.
Constructors
public VisibilitySensor(Action<VisibilitySensor> onVisible, bool singleCall = true, IComponent message = null)Initializes a new instance of the VisibilitySensor class.
Parameters
- onVisible
- The action to perform when the sensor becomes visible.
- singleCall
- Whether to trigger the action only once.
- message
- An optional component to display as the content of the sensor.