Skip to content

Commit

Permalink
Update API Readme to indicate renderWhenVisible function is optional (
Browse files Browse the repository at this point in the history
#7285)

* using less normative languange

* grammar
  • Loading branch information
scottbell authored Dec 13, 2023
1 parent 9ed8d4f commit 902ed02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ The show function is responsible for the rendering of a view. An [Intersection O
### Implementing Visibility-Based Rendering
The `renderWhenVisible` function is passed to the show function as a required part of the `viewOptions` object. This function should be used for all rendering logic that would otherwise be executed within a `requestAnimationFrame` call. When called, `renderWhenVisible` will either execute the provided function immediately (via `requestAnimationFrame`) if the view is currently visible, or defer its execution until the view becomes visible.
The `renderWhenVisible` function is passed to the show function as part of the `viewOptions` object. This function can be used for all rendering logic that would otherwise be executed within a `requestAnimationFrame` call. When called, `renderWhenVisible` will either execute the provided function immediately (via `requestAnimationFrame`) if the view is currently visible, or defer its execution until the view becomes visible.
Additionally, `renderWhenVisible` returns a boolean value indicating whether the provided function was executed immediately (`true`) or deferred (`false`).
Expand All @@ -1325,7 +1325,7 @@ Here’s the signature for the show function:
* `element` (HTMLElement) - The DOM element where the view should be rendered.
* `isEditing` (boolean) - Indicates whether the view is in editing mode.
* `viewOptions` (Object) - A required object with configuration options for the view, including:
* `viewOptions` (Object) - An object with configuration options for the view, including:
* `renderWhenVisible` (Function) - This function wraps the `requestAnimationFrame` and only triggers the provided render logic when the view is visible in the viewport.
### Example
Expand Down

0 comments on commit 902ed02

Please sign in to comment.