mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-24 02:02:53 +02:00
Fix review comments: https://github.com/mdn/webextensions-examples/issues/28#issuecomment-172645256
* added README * do name->URL conversion in the popup * define functions before they are added as listeners
This commit is contained in:
@@ -1,8 +1,3 @@
|
||||
/*
|
||||
Assign beastify() as a listener for messages from the extension.
|
||||
*/
|
||||
chrome.runtime.onMessage.addListener(beastify);
|
||||
|
||||
/*
|
||||
beastify():
|
||||
* removes every node in the document.body,
|
||||
@@ -11,7 +6,7 @@ beastify():
|
||||
*/
|
||||
function beastify(request, sender, sendResponse) {
|
||||
removeEverything();
|
||||
insertBeast(beastNameToURL(request.beast));
|
||||
insertBeast(request.beastURL);
|
||||
chrome.runtime.onMessage.removeListener(beastify);
|
||||
}
|
||||
|
||||
@@ -36,6 +31,12 @@ function insertBeast(beastURL) {
|
||||
document.body.appendChild(beastImage);
|
||||
}
|
||||
|
||||
/*
|
||||
Assign beastify() as a listener for messages from the extension.
|
||||
*/
|
||||
chrome.runtime.onMessage.addListener(beastify);
|
||||
|
||||
|
||||
/*
|
||||
Given the name of a beast, get the URL to the corresponding image.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user