Skip to content

Commit

Permalink
Reload settings page on storage change
Browse files Browse the repository at this point in the history
  • Loading branch information
aiden2480 committed Jun 15, 2022
1 parent e98bae3 commit 9ab873c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ async function generateSettingsPage() {
}

function ensureDefaultConfiguration() {
// TODO Sometimes this isn't resolving leading to the page hanging
// Add a timeout resolver?

return new Promise((resolve, reject) => {
chrome.runtime.sendMessage({type: "ensureDefaultConfig"}, resolve);
});
Expand Down Expand Up @@ -279,3 +282,10 @@ document.getElementById("videoslider").addEventListener("change", async (event)
var videoSpeed = event.target.value / 100;
chrome.storage.local.set({ videoSpeed });
});

// Refresh content on the screen if anything changes
chrome.storage.onChanged.addListener(async (changes, namespace) => {
if (!"customsets" in changes) return;

generateSettingsPage();
});

0 comments on commit 9ab873c

Please sign in to comment.