Update ryd.background.js

- Doesn't steal focus
- Prevents the second time popup before opt-in
This commit is contained in:
sy-b authored and GitHub committed 2022-04-22 20:39:58 +05:30
1 parent 4025503b9c
commit b63a5c08eb
1 file changed
+10 -6
+10 -6
View File
@@ -74,12 +74,16 @@ api.runtime.onMessage.addListener((request, sender, sendResponse) => {
} }
}); });
api.storage.sync.get(['showChangelog'], (details) => { api.storage.sync.get(['lastShowChangelogVersion'], (details) => {
if (details.showChangelog !== false) { if (extConfig.showUpdatePopup === true &&
api.tabs.create({url: api.runtime.getURL("/changelog/3/changelog_3.0.html")}); details.lastShowChangelogVersion !== chrome.runtime.getManifest().version
api.storage.sync.set({'showChangelog': false}); ) {
} // keep it inside get to avoid race condition
}); api.storage.sync.set({'lastShowChangelogVersion ': chrome.runtime.getManifest().version});
// wait until async get runs & don't steal tab focus
api.tabs.create({url: api.runtime.getURL("/changelog/3/changelog_3.0.html"), active: false});
}
});
async function sendVote(videoId, vote) { async function sendVote(videoId, vote) {
api.storage.sync.get(null, async (storageResult) => { api.storage.sync.get(null, async (storageResult) => {