Skip to content

Commit

Permalink
Update background.js
Browse files Browse the repository at this point in the history
  • Loading branch information
supechicken authored May 28, 2022
1 parent 6e07a0a commit b57371a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ function getKeyFromStorage (key) {

// prompt user to configure after install
chrome.runtime.onInstalled.addListener(i => {
if (i.reason == 'install') chrome.windows.create({url: 'popup.html', type: 'popup', height: 300, width: 450 })
if (i.reason == 'install') {
// wait 1 sec before opening the window to prevent the browser from stealing the focus
setTimeout(() => {
chrome.windows.create({url: 'popup.html', type: 'popup', height: 300, width: 450 })
}, 1000);
}
});

(async () => {
Expand Down Expand Up @@ -70,4 +75,4 @@ chrome.runtime.onInstalled.addListener(i => {
console.log('[debug]:', 'Notification closed.');
notification_exist = false
});
})();
})();

0 comments on commit b57371a

Please sign in to comment.