-
Notifications
You must be signed in to change notification settings - Fork 6
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
create preferencesStorage.js #737
Comments
Another nice part about our strategy is that we can gracefully add in what we want to support as we go. From phetsims/chipper#1042 all I care about most is the three voicing levels checkboxes and the speech rate. That is where I will begin with this experiementation. |
Note that we have to try catch that localStorage is supported, like https://github.com/phetsims/phet-io-wrappers/blob/361a103ffac5d317d28bd9077fe8019cad72ffc1/playback/js/loadSessions.js#L323-L339 |
@jessegreenberg, here is a start. Can you review, and also think/add any others that you may be wanting here. Should we add this to phetmarks? |
There seems to be something still out of sync here. I'm unsure what it is. I'll keep taking a look. Perhaps preferencesStrorage.register cannot be so "late" in the startup sequence: in the view where used in the Preferences panel. I'll see what the trouble is first though. |
This is caused because the PreferencesDialog is created lazily, thus the PreferencesStorage registration is also done lazily. @jessegreenberg, I think we may need to create a more central, "model-like" spot to register the preferences we have. Then pass that object to the view. What do you think? |
@jessegreenberg and I discussed this, and we feel like creating a more base-level "PreferencesModel" is the way to go. This will house all the Properties used by the view so that the view doesn't sprinkle in dependencies. It also allows for a single place where PreferencesStorage can register Properties. This seems much more prudent to me. We discussed briefly the though of just creating the dialog on startup, but didn't like forcing that to support PreferencesStorage. It also didn't seem very MVC. We will refactor in #743, and then come back here to register things. |
@jessegreenberg will let me know when this is ready for further work. |
Added rate and pitch above to greatly increase my productivity while testing. It adds to the list that would be refactored into a PreferencesModel, but not too horribly I think. |
Added interactiveHighlights property above. I have made some progress in #743, it would be good to touch base with @jessegreenberg in this issue to see if he ever uses |
Ok. I updated this to house more Properties that PreferencesModel supports. Please review. Is there anything else you'd like here? |
This is great, thank you! I am loving this feature. There was a TODO that I just removed about where to put Ready to close? |
I wonder if we should add any more to preferencesStorage? Also I wonder if customPreferences properties that are getting linked should be stored here. Perhaps via an option? I'll take a look. |
I'm wondering if we can figure out a way to combine the function to link phet-io elements and register for preferences storage. I'll think about it. |
From phetsims/chipper#1042 (comment), @jessegreenberg and I want to create a way to store preferences with localStorage when possible.
We discussed how to do this for quite some time, with a few options.
preferencesStorage.register()
which is called within the preferences UI to mark a Property as something that should support this local storage feature.Good luck us!
The text was updated successfully, but these errors were encountered: