spot: add err ctx, add iterator for values
This commit is contained in:
parent
a371c79151
commit
c6299c4592
1 changed files with 2 additions and 1 deletions
|
|
@ -10,7 +10,7 @@ export async function attachDebuggerToTab(tabId: string | number) {
|
|||
if (requestMaps[tabId] && potentialActiveTabs.includes(tabId)) return;
|
||||
await new Promise((resolve, reject) => {
|
||||
chrome.debugger.attach({ tabId }, "1.3", () => {
|
||||
if (chrome.runtime.lastError) return reject(chrome.runtime.lastError.message);
|
||||
if (chrome.runtime.lastError) return reject(`${chrome.runtime.lastError.message}, ${tabId}`);
|
||||
if (!requestMaps[tabId]) requestMaps[tabId] = {};
|
||||
potentialActiveTabs.push(tabId);
|
||||
chrome.debugger.sendCommand({ tabId }, "Network.enable", {}, resolve);
|
||||
|
|
@ -102,4 +102,5 @@ export function getRequests(tabId?: string) {
|
|||
if (tabId) {
|
||||
return Object.values(requestMaps[tabId] || {});
|
||||
}
|
||||
return Object.values(requestMaps).reduce((acc, curr) => acc.concat(Object.values(curr)), []);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue