Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setAutoPause() method #2411

Merged
merged 1 commit into from
Nov 1, 2023
Merged

Add setAutoPause() method #2411

merged 1 commit into from
Nov 1, 2023

Conversation

texodus
Copy link
Member

@texodus texodus commented Nov 1, 2023

This PR adds a new API method to the <perspective-viewer> custom element, setAutoPause(). When enabled with viewer.setAutoPause(true), the <perspective-viewer> will register an IntersectionObserver to test its own visibility, enabling a new internal "pause" state when offscreen. The new "pause" state deletes its internal View, freeing any resources associated with it, and doesn't recreate it until the IntersectionObserver changes state, so while efficient for many small-data viewers, this may not yet be the right feature for a handful of large-data viewers. A future iteration which does not delete the View (but just supresses rendering) may be a future iteration of this feature.

@texodus texodus added the enhancement Feature requests or improvements label Nov 1, 2023
@texodus texodus merged commit 6006c1b into master Nov 1, 2023
12 checks passed
@texodus texodus deleted the intersection-observer branch November 1, 2023 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests or improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant