yt-addiction-control/popup/control.js
2019-06-29 21:47:18 +02:00

14 lines
344 B
JavaScript

/**
* Listen for clicks on the buttons, and send the appropriate message to
* the content script in the page.
*/
document.addEventListener("click", (e) => {
function applyChange(tabs) {
browser.tabs.sendMessage(tabs[0].id, {
command: e.target.id
});
}
browser.tabs.query({active: true, currentWindow: true})
.then(applyChange);
});