Files
kintone-helper-extenstion/background.js
2025-10-17 14:39:33 +08:00

23 lines
617 B
JavaScript

chrome.action.onClicked.addListener(async (tab) => {
try {
// Inject the modules and then execute the main function
await chrome.scripting.executeScript({
target: { tabId: tab.id },
files: ["fields.js"],
world: "MAIN"
});
await chrome.scripting.executeScript({
target: { tabId: tab.id },
files: ["dom.js"],
world: "MAIN"
});
await chrome.scripting.executeScript({
target: { tabId: tab.id },
files: ["main.js"],
world: "MAIN"
});
} catch (error) {
console.error("Error injecting scripts:", error);
}
});