mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-07 20:17:05 +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.
|
// 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.
|
// This happens on Safari, Firefox, and Chromium 101 (inclusive) and below.
|
||||||
|
chrome.tabs.onUpdated.addListener(onTabUpdatedListener);
|
||||||
utils.wait(() => Config.local !== null).then(() => {
|
utils.wait(() => Config.local !== null).then(() => {
|
||||||
if (!Config.local.navigationApiAvailable)
|
if (Config.local.navigationApiAvailable) {
|
||||||
chrome.tabs.onUpdated.addListener(onTabUpdatedListener);
|
chrome.tabs.onUpdated.removeListener(onTabUpdatedListener);
|
||||||
})
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (!Config.configSyncListeners.includes(onNavigationApiAvailableChange)) {
|
if (!Config.configSyncListeners.includes(onNavigationApiAvailableChange)) {
|
||||||
Config.configSyncListeners.push(onNavigationApiAvailableChange);
|
Config.configSyncListeners.push(onNavigationApiAvailableChange);
|
||||||
|
|||||||
@@ -287,7 +287,7 @@ const Config: SBObject = {
|
|||||||
},
|
},
|
||||||
localDefaults: {
|
localDefaults: {
|
||||||
downvotedSegments: {},
|
downvotedSegments: {},
|
||||||
navigationApiAvailable: null,
|
navigationApiAvailable: null
|
||||||
},
|
},
|
||||||
cachedSyncConfig: null,
|
cachedSyncConfig: null,
|
||||||
cachedLocalStorage: null,
|
cachedLocalStorage: null,
|
||||||
|
|||||||
Reference in New Issue
Block a user