-
Notifications
You must be signed in to change notification settings - Fork 887
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
Ensure screen saver blocker removed when window closed #3557
Ensure screen saver blocker removed when window closed #3557
Conversation
@@ -42,6 +42,10 @@ const VHS_BANDWIDTH_VARIANCE = videojs.Vhs.BANDWIDTH_VARIANCE | |||
|
|||
export default defineComponent({ | |||
name: 'FtVideoPlayer', | |||
beforeRouteLeave: function (_to, _from, next) { | |||
window.removeEventListener('beforeunload', this.stopPowerSaveBlocker) |
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 am not sure if this can/should be moved into beforeDestroy
But this is how it's done currently in Watch
view
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.
This has to be moved to beforeDestroy
, the route hooks only get triggered in components that are directly inside the router view. So for us those are the components in the src/renderer/views
. Additionally the player gets destroyed and a new instance created when you change formats (maybe we can change that in the future, but for the moment that makes it easier for us), so you want this removed as soon as it's destroyed, so that you get rid of the event handler for all instances of the player.
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.
Updated
@ChunkyProgrammer need more approval chunks |
Pull Request Type
Related issue
Similar to #1217
Might work for reload case in #3286 too
Description
beforeDestroy
doesn't work for window closenklayman/vue-cli-plugin-electron-builder#389
Screenshots
Lazy! (Well or a video with at least 1 min is needed, definitely too big to be uploaded)
Testing
Desktop
Additional context