Update API Readme to indicate renderWhenVisible function is optional (#7285)

* using less normative languange

* grammar
This commit is contained in:
Scott Bell 2023-12-13 10:57:48 +01:00 committed by GitHub
parent 9ed8d4f5a5
commit 902ed0274a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
API.md
View File

@ -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`).
@ -1325,7 +1325,7 @@ Heres 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