mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
Don't wait to add listener
This commit is contained in:
@@ -41,10 +41,12 @@ function onNavigationApiAvailableChange(changes: {[key: string]: chrome.storage.
|
||||
|
||||
// If Navigation API is not supported, then background has to inform content script about video change.
|
||||
// This happens on Safari, Firefox, and Chromium 101 (inclusive) and below.
|
||||
chrome.tabs.onUpdated.addListener(onTabUpdatedListener);
|
||||
utils.wait(() => Config.local !== null).then(() => {
|
||||
if (!Config.local.navigationApiAvailable)
|
||||
chrome.tabs.onUpdated.addListener(onTabUpdatedListener);
|
||||
})
|
||||
if (Config.local.navigationApiAvailable) {
|
||||
chrome.tabs.onUpdated.removeListener(onTabUpdatedListener);
|
||||
}
|
||||
});
|
||||
|
||||
if (!Config.configSyncListeners.includes(onNavigationApiAvailableChange)) {
|
||||
Config.configSyncListeners.push(onNavigationApiAvailableChange);
|
||||
|
||||
@@ -287,7 +287,7 @@ const Config: SBObject = {
|
||||
},
|
||||
localDefaults: {
|
||||
downvotedSegments: {},
|
||||
navigationApiAvailable: null,
|
||||
navigationApiAvailable: null
|
||||
},
|
||||
cachedSyncConfig: null,
|
||||
cachedLocalStorage: null,
|
||||
|
||||
Reference in New Issue
Block a user