CI / Lint + tests (push) Has been cancelled
Ship a shared markdown/prompt core used by a Brave/Chrome MV3 extension and a Python automation API, with pytest coverage, CI, and packaging smoke.
19 lines
611 B
JavaScript
19 lines
611 B
JavaScript
// background.js — Context Extractor service worker
|
|
// Persists the selector chosen via the in-page element picker so the popup
|
|
// can pre-fill it the next time it opens.
|
|
|
|
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
|
|
if (!msg || !msg.type) return false;
|
|
|
|
if (msg.type === "PICKER_SELECTED") {
|
|
const selector = msg.selector || "";
|
|
chrome.storage.session
|
|
.set({ pickerSelector: selector })
|
|
.then(() => sendResponse({ ok: true }))
|
|
.catch((err) => sendResponse({ ok: false, error: String(err) }));
|
|
return true; // async response
|
|
}
|
|
|
|
return false;
|
|
});
|