TabsAsideExtension
TabsAsideExtension copied to clipboard
Reworking settings
Hi !
As briefly mentioned in #48 , I think it may be wise to rework the code around settings. It is piling up quite a lot in there : https://github.com/XFox111/TabsAsideExtension/blob/d8c31e3da5a829fc5bcdb4933f5d798a958b2552/js/aside-script.js#L84-L177
Firstly, by using the same mechanism as #48, we could have a single storage listener, with a switch case for any setting/collection that sends any relevant updates to the panes. Like this :
chrome.storage.onChanged.addListener((changes, namespace) =>
{
if (namespace == "sync")
for (key in changes)
switch(key){
case "sets":
//code for sets
//Send message to aside scripts to update the UI
break;
case "someSetting":
//code for the setting
//Send message to aside scripts to update the UI
//other settings.
}
});
This seems important to have these in the background script : currently, the listener for the settings are in the pane scripts, so if a settings update (from sync) occurs when the pane is closed (=> very likely), it won't be taken into account until the pane is opened again. It does not matter for some options such as "Load tabs on restore", since the pane has to be open anyway to use it, but it may for some other options
A second change that could be done, but I'm not sure about this one, is having all these settings stored inside a "settings" object. It may make work easier, but it may make it harder as well.
What do you think about it ?
Yep. Sounds great! If you want, you can take the issue. Unfortunately, for the next several weeks I'll be unable to work on the extension, but I probably will be able to find some time to review new contributions
No worries, same situation over here - work in the summer, now back to studying very soon - but there's no rush for 2.0, so let's focus on what's important first :) . I'll send a message over here before I start working on this issue.