From 600c337b1cdc884aebf59083eb57b178b43441ce Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Mon, 13 Jul 2026 11:35:08 +0530 Subject: docs: added some documentation comments to all functions --- src/background/run-ocr.ts | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/background') diff --git a/src/background/run-ocr.ts b/src/background/run-ocr.ts index 7975fc0..4d0b080 100644 --- a/src/background/run-ocr.ts +++ b/src/background/run-ocr.ts @@ -1,6 +1,10 @@ const OFFSCREEN_DOCUMENT_PATH = "offscreen/ocr/index.html"; // Function to ensure the offscreen document is open +/** + * Ensures the offscreen OCR document is open. If it already exists + * this is a no-op. + */ async function setupOffscreenDocument() { if (await chrome.offscreen.hasDocument()) { return; // Offscreen document already open @@ -13,6 +17,11 @@ async function setupOffscreenDocument() { } // Listen for messages from content scripts (and popup if applicable) +/** + * Listens for `"OCR"` messages from content scripts. Forwards the + * image data URL to an offscreen document for Tesseract.js processing + * and sends the recognised text back to the caller. + */ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { if (message.type === "OCR" && message.dataURL) { (async () => { -- cgit v1.2.3