From 00e5ea80b1b0ba37ac4b5dc7b10ae6eac26aa1af Mon Sep 17 00:00:00 2001 From: Arpit Chakladar <54011232+arpitchakladar@users.noreply.github.com> Date: Fri, 13 Jun 2025 18:36:30 +0530 Subject: Successfully communicating between background script and content scripts. --- src/background/run-ocr.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/background/run-ocr.ts') diff --git a/src/background/run-ocr.ts b/src/background/run-ocr.ts index d0af073..d61e71a 100644 --- a/src/background/run-ocr.ts +++ b/src/background/run-ocr.ts @@ -1 +1,7 @@ -console.log("THIS IS A BACKGROUND script."); +chrome.runtime.onMessage.addListener(async (message, sender, sendResponse) => { + if (message.type === "ping") { + console.log("Received ping from content script"); + console.log(message.data); + sendResponse({ text: "pong" }); + } +}); -- cgit v1.2.3