Add local storage options to config

This commit is contained in:
Ajay
2022-02-06 19:17:20 -05:00
parent ccb0e8bed9
commit 816e9a78be
6 changed files with 80 additions and 38 deletions

View File

@@ -360,8 +360,8 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
// Perform a second update after the config changes take effect as a workaround for a race condition
const removeListener = (listener: typeof lateUpdate) => {
const index = Config.configListeners.indexOf(listener);
if (index !== -1) Config.configListeners.splice(index, 1);
const index = Config.configSyncListeners.indexOf(listener);
if (index !== -1) Config.configSyncListeners.splice(index, 1);
};
const lateUpdate = () => {
@@ -369,7 +369,7 @@ async function runThePopup(messageListener?: MessageListener): Promise<void> {
removeListener(lateUpdate);
};
Config.configListeners.push(lateUpdate);
Config.configSyncListeners.push(lateUpdate);
// Remove the listener after 200ms in case the changes were propagated by the time we got the response
setTimeout(() => removeListener(lateUpdate), 200);