diff --git a/package-lock.json b/package-lock.json index 1cb95d2..2bd2e23 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@hardbulls/baseball-ticker-cxt", - "version": "1.0.2", + "version": "1.0.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@hardbulls/baseball-ticker-cxt", - "version": "1.0.2", + "version": "1.0.3", "license": "UNLICENSED", "dependencies": { "firebase": "^10.6.0" diff --git a/package.json b/package.json index 1627d50..c1882f8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/cxt/background.ts b/src/cxt/background.ts index d25424c..6344703 100644 --- a/src/cxt/background.ts +++ b/src/cxt/background.ts @@ -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; @@ -42,6 +48,8 @@ import { MessageType } from "../lib/model/MessageType"; return true; } + sendResponse(false); + return false; }); diff --git a/src/cxt/overlay.ts b/src/cxt/overlay.ts index 96ebaf4..d76e955 100644 --- a/src/cxt/overlay.ts +++ b/src/cxt/overlay.ts @@ -187,4 +187,6 @@ import { MessageType } from "../lib/model/MessageType"; updateFilterColor(); updateSponsors(); updateStyle(); + + await chrome.runtime.sendMessage({ type: MessageType.KEEP_AWAKE }); })(); diff --git a/src/lib/api/SponsorsRepository.ts b/src/lib/api/SponsorsRepository.ts index ed000df..8390cff 100644 --- a/src/lib/api/SponsorsRepository.ts +++ b/src/lib/api/SponsorsRepository.ts @@ -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;