Yay a devtools!

This commit is contained in:
2025-02-15 12:46:42 -07:00
parent 9124abb749
commit 8d379461c3
8 changed files with 265 additions and 217 deletions

View File

@@ -1,20 +1,12 @@
console.log("content.js loaded", window.wrappedJSObject);
// setTimeout(() => {
const getContextStack = () => window.wrappedJSObject.getContextStack();
const updateContextValue = (key, value, depth) =>
window.wrappedJSObject.updateContextValue(key, value, depth);
console.log(getContextStack());
browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.type === "GET_CONTEXT_STACK") {
const contextStack = getContextStack();
const contextStack = window.wrappedJSObject.getContextStack();
sendResponse({ contextStack });
} else if (message.type === "UPDATE_CONTEXT_VALUE") {
const { key, value, depth } = message;
if (glowindow.updateContextValue) {
updateContextValue(key, value, depth);
if (window.wrappedJSObject.updateContextValue) {
window.wrappedJSObject.updateContextValue(key, value, depth);
sendResponse({ success: true });
} else {
sendResponse({
@@ -24,4 +16,5 @@ browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
}
}
});
// }, 0);
browser.runtime.sendMessage({ type: "PAGE_LOADED" });