We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d3c5ff6 commit ac40b83Copy full SHA for ac40b83
scripts/helpers/utils.js
@@ -4,6 +4,13 @@ const { version } = chrome.runtime?.getManifest() || {};
4
5
export function waitForTabToLoad(tabId) {
6
return new Promise((resolve) => {
7
+ // check if tab already loaded
8
+ if (chrome.tabs.get(tabId)?.status === "complete") {
9
+ resolve();
10
+ return;
11
+ }
12
+
13
+ // listen for tab load
14
chrome.tabs.onUpdated.addListener(function listener(_tabId, info) {
15
if (tabId === _tabId && info.status === "complete") {
16
chrome.tabs.onUpdated.removeListener(listener);
0 commit comments