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

Disconnect call is skipped on Chrome pwa when quit. #14

Open
jakerr opened this issue Mar 8, 2022 · 1 comment
Open

Disconnect call is skipped on Chrome pwa when quit. #14

jakerr opened this issue Mar 8, 2022 · 1 comment

Comments

@jakerr
Copy link

jakerr commented Mar 8, 2022

This was tested with PWA installed on Chrome.
The disconnect is not called when the app is quit. On hardware M8 this is going to be less noticeable, but on headless Teensy, this means that autosave won't be executed.

Closing the window via the 'x' button in the window corner does seem to execute the autosave.
I don't know if there's another hook that could be used or a workaround that can be done in code.

@jakerr jakerr changed the title Disconnect call is skipped on Chrome when pop-ups are blocked Disconnect call is skipped on Chrome pwa when quit. Mar 8, 2022
@derkyjadex
Copy link
Owner

I wasn't aware that the disable command triggered an autosave; I thought that it was mainly to tell the Teensy/M8 to stop generating and sending display commands over USB serial.

After doing a bit of looking around, I think it might make sense to use the visibilitychange event to send the enable/disable commands whenever the tab or window is shown or hidden. This is supposed to be a more reliable way of detecting a page being closed than the beforeunload event, although it will be fired in more cases than just closing the page.

I'll have to have more of a think about this and take a look into how the autosave works on the M8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants