Skip to content

Commit

Permalink
Handle network requests made before opening extension
Browse files Browse the repository at this point in the history
Should fix #24. This was actually the original behaviour but got
refactored out. I don't think it's possible to run code before our
DevTools panel becomes active, but it's a small change to process
whatever the Network panel has already seen, and a significant quality
of life improvement. Thanks @ScottyMJacobson!
  • Loading branch information
jethron committed Mar 14, 2019
1 parent 8950d29 commit a88ae7b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/BeaconInspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,14 @@ const BeaconInspector = () => {
}

return {
// @ts-ignore typedefs for chrome aren't complete for the HAR spec.
oninit: () => chrome.devtools.network.onRequestFinished.addListener(handleNewRequest),
oninit: () => {
chrome.devtools.network.getHAR((harLog) => {
(harLog as { entries: har.Entry[] }).entries.map(handleNewRequest);

// @ts-ignore typedefs for chrome aren't complete for the HAR spec.
chrome.devtools.network.onRequestFinished.addListener(handleNewRequest);
});
},
view: () => ([
m(Toolbar, {
clearRequests: () => (requests = [], active = undefined),
Expand Down

0 comments on commit a88ae7b

Please sign in to comment.