-
Notifications
You must be signed in to change notification settings - Fork 419
pause: Automatically pause project when the page is not focused
#5838
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
Conversation
Co-authored-by: Chiroyce <97374054+Chiroyce1@users.noreply.github.com>
|
Should the project automatically unpause when the user comes back to the tab? |
Try adding if (addon.settings.get("auto-pause")) document.addEventListener("focusout", setPaused(true));above the settings change event listener. |
|
@Samq64 You meant |
Yeah, thanks for catching that. |
What's the difference? |
Co-authored-by: Samq64 <81489795+Samq64@users.noreply.github.com>
Samq64
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the project automatically resume when the setting is dynamically disabled?
No. That would only add extra complication. And if the user manually pauses and then disables the setting, the project would resume, even if it shouldn't. |
Co-authored-by: Samq64 <81489795+Samq64@users.noreply.github.com>
pause: AUtomatically pause project when the page is not focused
pause: AUtomatically pause project when the page is not focusedpause: Automatically pause project when the page is not focused
DNin01
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should probably mention that pausing could affect Cloud multiplayer games.
By manually pausing you can often mess up projects with online multiplayer already (cause things like multiple players claiming the same cloud slot). However, now that we can automatically pause the project for the user, we can cause Cloud issues ourselves. If we do, that's on us and it could be a problem.
So, if we detect Cloud activity that follows certain patterns, we shouldn't pause those projects automatically.
If we can't do that, don't worry too much — connection issues can also trigger the same problems, perhaps more often than we would.
|
@DNin01 your review adds a new perspective I didn't think about. Maybe we should add an option to prevent pause for projects with cloud variables, maybe even mitigations for the addon itself (not just this option)? |
Indeed, we could consider entirely disabling the pause function on these types of projects. |
I wouldn't say disabling though. People with the knowledge could still bypass the restriction (via devtools). Maybe we should add a "Allow pausing on projects with cloud variables" setting and mark it as Dangerous? |
|
Whaddya say we just don't auto-pause if cloud data activity (send/receive) occurred on the cloud WebSocket connection in the last 15 seconds? That should mitigate most of the issues potentially introduced by pausing those projects. |
Sounds good, maybe also add a notice in the settings. |
Done in #8555. |
Resolves #5836
Changes
Add an option to the pause addon to pause the project when the tab is not focused.
Reason for changes
Many users would like the project to be paused when they enter another window, e. g. to not lose progress in runner games.
Tests
It only pauses once when you change the addon's settings. Can anyone look at the code?