Created
September 1, 2018 12:10
-
-
Save evilpie/971c808151a61476c3a38101a00282b5 to your computer and use it in GitHub Desktop.
Input handling WebExtension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
browser.runtime.onMessage.addListener(message => { | |
browser.search.search({query: "foobar"}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"manifest_version": 2, | |
"name": "Input Handling", | |
"version": "1.0", | |
"permissions": [ | |
"search" | |
], | |
"content_scripts": [{ | |
"matches": ["<all_urls>"], | |
"js": ["script.js"] | |
}], | |
"background": { | |
"scripts": ["background.js"] | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("click", event => { | |
console.log("click"); | |
browser.runtime.sendMessage({clicked: true}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment