Skip to content

Commit

Permalink
fix sponsor downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
arjanfrans committed Apr 28, 2024
1 parent 5c38039 commit e28aa1a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hardbulls/baseball-ticker-cxt",
"description": "Baseball Ticker - Chrome Extension",
"version": "1.0.3",
"version": "1.0.4",
"private": true,
"author": {
"name": "Arjan Frans",
Expand Down
16 changes: 12 additions & 4 deletions src/cxt/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ import { MessageType } from "../lib/model/MessageType";
let enableRemote = popupState.enableRemote;
let shouldReconnect = true;

chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => {
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.type === MessageType.KEEP_AWAKE || message.type === MessageType.ALLOW_SLEEP) {
const tab = sender.tab;

if (tab?.id) {
await chrome.tabs.update(tab.id, {
autoDiscardable: MessageType.KEEP_AWAKE !== message.type,
});
chrome.tabs.update(
tab.id,
{
autoDiscardable: MessageType.KEEP_AWAKE !== message.type,
},
() => {
sendResponse(true);
}
);
}

return true;
Expand All @@ -42,6 +48,8 @@ import { MessageType } from "../lib/model/MessageType";
return true;
}

sendResponse(false);

return false;
});

Expand Down
2 changes: 2 additions & 0 deletions src/cxt/overlay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,6 @@ import { MessageType } from "../lib/model/MessageType";
updateFilterColor();
updateSponsors();
updateStyle();

await chrome.runtime.sendMessage({ type: MessageType.KEEP_AWAKE });
})();
2 changes: 2 additions & 0 deletions src/lib/api/SponsorsRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export abstract class SponsorsRepository {
new Promise((resolve) => {
chrome.runtime.sendMessage({ type: MessageType.FETCH, url: "https://www.hardbulls.com/sponsoren" }, (response) => {
resolve(response);

return true;
});
})
)) as string;
Expand Down

0 comments on commit e28aa1a

Please sign in to comment.