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

SDL_APP_TERMINATING on page exit #88

Beuc opened this issue Aug 14, 2019 · 2 comments


Copy link

commented Aug 14, 2019

I'm considering how to save some of the game data when the player leaves the web page.

I believe that sending SDL_APP_TERMINATING on window.beforeunload, and offering the developer to catch it with a synchronous SDL_AddEventWatch() (the game won't have a change to run its event loop), would make the most sense in the SDL2 emscripten port.

I'm going to do some testing, let me know if that's something you'd appreciate a PR for :)


This comment has been minimized.

Copy link

commented Aug 15, 2019

I think this came up while working on the initial port. There was an attempt at sending window close/quit events (gsathya/SDL-emscripten@4c2637c) which didn't work, but I wasn't aware of SDL_AddEventWatch back then.


This comment has been minimized.

Copy link
Contributor Author

commented Aug 16, 2019

I pushed #89.
Please find attached a test app :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.