(tabId)
| 88 | } |
| 89 | |
| 90 | export function waitForTabToLoad(tabId) { |
| 91 | return new Promise((resolve) => { |
| 92 | // check if tab already loaded |
| 93 | if (chrome.tabs.get(tabId)?.status === "complete") { |
| 94 | resolve(); |
| 95 | return; |
| 96 | } |
| 97 | |
| 98 | // listen for tab load |
| 99 | chrome.tabs.onUpdated.addListener(function listener(_tabId, info) { |
| 100 | if (tabId === _tabId && info.status === "complete") { |
| 101 | chrome.tabs.onUpdated.removeListener(listener); |
| 102 | resolve(); |
| 103 | } |
| 104 | }); |
| 105 | }); |
| 106 | } |
| 107 | |
| 108 | export function runFunc(fnPath = "", params = [], global = {}) { |
| 109 | return new Promise((resolve) => { |
no test coverage detected