Skip to content

Commit

Permalink
refactor:Added typing
Browse files Browse the repository at this point in the history
  • Loading branch information
juskek committed Jul 21, 2023
1 parent 315e91f commit 75dc4e1
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/background/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,21 @@ chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => {
return true;
});

chrome.debugger.onEvent.addListener(function (source, method, params) {
switch (method) {
case "Network.loadingFinished": {
const { encodedDataLength } = params as {
encodedDataLength?: number;
};
if (encodedDataLength) {
addBytesTransferred(encodedDataLength);
type NetworkParamsType = {
encodedDataLength?: number;
};

chrome.debugger.onEvent.addListener(
(source, method: string, params: NetworkParamsType | undefined) => {
switch (method) {
case "Network.loadingFinished": {
if (params?.encodedDataLength && params.encodedDataLength > 0) {
addBytesTransferred(params.encodedDataLength);
}
break;
}
break;
default:
break;
}
default:
break;
}
});
);

0 comments on commit 75dc4e1

Please sign in to comment.