ueberdosis / hocuspocus

The CRDT Yjs WebSocket backend for conflict-free real-time collaboration in your app.
https://tiptap.dev/docs/hocuspocus/introduction
MIT License
1.19k stars 115 forks source link

Replace deprecated `unload` event with `pagehide` event #824

Closed jul13579 closed 3 months ago

jul13579 commented 3 months ago

Dear hocuspocus folks,

I noticed that the HocuspocusProvider is using the deprecated unload event. MDN advises to use the pagehide event instead, so this is what I chose to use for this PR. I searched for any open and closed issues and PRs that could be related to this and hence am aware of #658 and #657, where the previously used beforeunload event was found to be problematic.

I checked if the pagehide event also fires when starting a download as described in #657 and found that it in fact does not fire. Therefore I think this event might be a viable alternative to unload.

Cheers, Julian

janthurau commented 3 months ago

Thanks! Sounds good :)