diff options
author | Ajay Ramachandran <[email protected]> | 2019-11-23 12:44:38 -0500 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2019-11-23 12:44:38 -0500 |
commit | dfad1a5636dac4063d5ec6fbe40db9a00106a18c (patch) | |
tree | ea53b8c9c573104a27f37762c7bd7b3f1eccba11 | |
parent | 6790952f860eab70bff38be9d300365b08423818 (diff) | |
download | SponsorBlock-dfad1a5636dac4063d5ec6fbe40db9a00106a18c.tar.gz SponsorBlock-dfad1a5636dac4063d5ec6fbe40db9a00106a18c.zip |
Added delayed startup after install.
-rw-r--r-- | background.js | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/background.js b/background.js index 1f8aad75..e10e59a4 100644 --- a/background.js +++ b/background.js @@ -42,22 +42,24 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) { //add help page on install chrome.runtime.onInstalled.addListener(function (object) { - chrome.storage.sync.get(["userID", "shownInstallPage"], function(result) { - const userID = result.userID; - - // If there is no userID, then it is the first install. - if (!userID){ - //open up the install page - chrome.tabs.create({url: chrome.extension.getURL("/help/"+chrome.i18n.getMessage("helpPage"))}); - - //generate a userID - const newUserID = generateUserID(); - //save this UUID - chrome.storage.sync.set({ - "userID": newUserID - }); - } - }); + setTimeout(function() { + chrome.storage.sync.get(["userID"], function(result) { + const userID = result.userID; + + // If there is no userID, then it is the first install. + if (!userID){ + //open up the install page + chrome.tabs.create({url: chrome.extension.getURL("/help/index_en.html")}); + + //generate a userID + const newUserID = generateUserID(); + //save this UUID + chrome.storage.sync.set({ + "userID": newUserID + }); + } + }); + }, 1500); }); //gets the sponsor times from memory |