diff options
| author | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-07-13 11:35:08 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-07-13 11:35:08 +0530 |
| commit | 600c337b1cdc884aebf59083eb57b178b43441ce (patch) | |
| tree | d1f3cb7eb1020bcdcd66d9dbf0279f79d5856332 /src/background | |
| parent | 98e7019c61ea0ffe344ef7ce809d38d62254a9fc (diff) | |
| download | banglar-bhumi-utils-600c337b1cdc884aebf59083eb57b178b43441ce.tar.gz banglar-bhumi-utils-600c337b1cdc884aebf59083eb57b178b43441ce.zip | |
docs: added some documentation comments to all functions
Diffstat (limited to 'src/background')
| -rw-r--r-- | src/background/run-ocr.ts | 9 |
1 files changed, 9 insertions, 0 deletions
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 () => { |
