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

Save state continuously; don't wait for unload #73

Open
dfabulich opened this issue May 8, 2020 · 0 comments
Open

Save state continuously; don't wait for unload #73

dfabulich opened this issue May 8, 2020 · 0 comments

Comments

@dfabulich
Copy link
Contributor

Apropos this comment:

I've removed the beforeunload event. Instead, on unload, the current map gets saved to localStorage.

I think it would be better to save state as the user creates it (every time something is pushed onto the "undo" stack). That way, state will survive even if the browser tab crashes.

(If we do this, I think it would make sense to switch to IndexedDB, which has an async API, to ensure that saving the map doesn't lock the main thread. I recommend idb-keyval.)

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

1 participant