yt-addiction-control/popup/control.js

14 lines
344 B
JavaScript
Raw Normal View History

2019-06-29 19:47:18 +00:00
/**
* 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);
});