Created
September 18, 2023 18:56
-
-
Save jikamens/bbe2795221de417f533001ebf1c4a418 to your computer and use it in GitHub Desktop.
messenger.mailTabs.getSelectedMessages() demo
This file contains 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
<!DOCTYPE html> | |
<html> | |
<body> | |
<div id="messageList"> | |
</div> | |
<script src="browserAction.js"></script> | |
</body> | |
</html> |
This file contains 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
async function init() { | |
let messages = await messenger.mailTabs.getSelectedMessages(); | |
let ul = document.createElement("ul"); | |
for (let message of messages.messages) { | |
let li = document.createElement("li"); | |
li.innerText = message.subject; | |
ul.appendChild(li); | |
} | |
messageList = document.getElementById("messageList"); | |
messageList.appendChild(ul); | |
} | |
window.addEventListener("load", init, false); |
This file contains 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": "getSelectedMessages demo", | |
"version": "1", | |
"applications": { | |
"gecko": { | |
"id": "[email protected]", | |
"strict_min_version": "115.0", | |
"strict_max_version": "*" | |
} | |
}, | |
"permissions": [ | |
"messagesRead" | |
], | |
"browser_action": { | |
"default_popup": "browserAction.html" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment