mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-25 02:32:51 +02:00
Use messaging instead of getBackgroundPage
This commit is contained in:
@@ -9,9 +9,11 @@ const defaultCode = "document.body.innerHTML = '<h1>This page has been eaten<h1>
|
||||
hostsInput.value = defaultHosts;
|
||||
codeInput.value = defaultCode;
|
||||
|
||||
async function registerScript() {
|
||||
let background = await browser.runtime.getBackgroundPage();
|
||||
background.register(hostsInput.value.split(","), codeInput.value)
|
||||
function registerScript() {
|
||||
browser.runtime.sendMessage({
|
||||
hosts: hostsInput.value.split(","),
|
||||
code: codeInput.value
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelector("#register").addEventListener('click', registerScript);
|
||||
|
||||
Reference in New Issue
Block a user