fisrt commit
This commit is contained in:
commit
984ff6cfce
15 files changed
+577
No files matched your search
@@ -0,0 +1,24 @@
|
||||
function injectedFunction(color) {
|
||||
document.body.style.backgroundColor = color;
|
||||
}
|
||||
|
||||
|
||||
chrome.runtime.onMessage.addListener(async ({ name, options }) => {
|
||||
if (name === 'addRecord') {
|
||||
console.log('Hello World!');
|
||||
|
||||
// get active tab
|
||||
// const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
||||
// chrome.scripting.executeScript({
|
||||
// target: { tabId: tab.id },
|
||||
// func: injectedFunction,
|
||||
// args: ["orange"],
|
||||
// });
|
||||
|
||||
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
||||
const response = await chrome.tabs.sendMessage(tab.id, { greeting: "hello" });
|
||||
// do something with response here, not outside the function
|
||||
console.log(response);
|
||||
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user