Added functionality to automatically save board states in localStorage#103
Closed
EliDoris wants to merge 3 commits intox-sheep:mainfrom
Closed
Added functionality to automatically save board states in localStorage#103EliDoris wants to merge 3 commits intox-sheep:mainfrom
EliDoris wants to merge 3 commits intox-sheep:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Author
|
Another note that I forgot to mention: Space in
|
Author
|
Closing request here since I'm opening it on the robx fork isntead |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated Boot.js to do caching in
localStorage. This is basically the implementation that penpa uses, except:beforeunloadbrowser event. I noticed that thevisibilitychangeevent was firing at pretty much any time I could imagine wanting to cache, and upon further investigation it seemsbeforeunloadis only really recommended when there is a desire to bring up a dialog and allow the user to cancel their decision to leaveThis was tested and works perfectly on Chrome Version 142.0.7444.163 (Official Build) (64-bit). I don't really know what the best way is to go about testing on other browsers, but the code as written should be able to discern if there is no
localStorageavailable and simply not do the caching in that case.I also tested it for a simple loop up to 75x75, which has a pretty long encoding, and it was fine. Upon inspection, it looks like this fairly extreme case gives me ~67,000 characters in the URL. The base URL is considerably shorter, so this encoding is like <0.2 MB with a high estimate. That means with a
localStoragecap of ~5MB for most browsers, there is very unlikely to be a real single puzzle that messes withlocalStorage. Right now if anything goes wrong with the cache write, all that really happens is that the caching doesn't happenFinal misc. thought: There isn't really a great way to give users an option to cache or not cache, since it seems that all of the persistent options available (e.g., yajilin styling) are encoded directly in URLs. That said, I don't believe penpa gives you this option either and that seems to work fine with almost exactly this implementation