FooSoft / yomichan

Japanese pop-up dictionary extension for Chrome and Firefox.
https://foosoft.net/projects/yomichan
Other
1.06k stars 213 forks source link

Settings improvements #296

Closed toasted-nutbread closed 3 years ago

toasted-nutbread commented 4 years ago

As the number of features Yomichan has has grown, so too has the number of settings. Some of the settings are more complex and require more logic than just a simple HTML input field to adjust. As such, new scripts have been added to control the more advanced behaviour. Such features currently include:

In order to simplify development of future settings and the corresponding UI, there are a few tasks that have come up which could improve the workflow:

toasted-nutbread commented 4 years ago

For reference, I have currently started on most if not all of these tasks. The first one is taken care of by 403b86675d288a8082125475f87f9b1740e3480a...767a480a847b641768b94b835a6ac10c1c3d69bf, which is just moving code around.

The remaining tasks are all somewhat intertwined, so fully implementing them will take a bit longer. I will put up a pull request for it when it is completed.

siikamiika commented 4 years ago

Have a common system for assigning settings which can be used from both the frontend and backend. Make this system the only method for assigning settings. I.e. the settings page will not have any direct references to the backend's options object. Instead, only copies should be passed around, and assignments/updates should use the API calls. This will primarily involve a refactoring of apiOptionsSet.

One thing I noticed when using apiOptionsSet in search page query parser was that await apiOptionsSet(...) didn't wait for the options to propagate back to DisplaySearch, and accessing the local copy of the options on the next line gave the previous value. I'm not sure how feasible it would be to wait for everything to call apiOptionsGet before resolving the promise.