Use messaging instead of getBackgroundPage

This commit is contained in:
Will Bamberg
2018-01-25 17:10:46 -08:00
parent 6377f7952a
commit f50bc509f6
2 changed files with 11 additions and 4 deletions
+5 -3
View File
@@ -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);