Reputation: 21
First of all I want to apologize if this question may seem too simple but I haven't found any solution since yesterday and I'm not very good at javascript. I want to create a personal Thunderbird addons that will communicate with an application I have created, for that I need to have a file attached in a message. I used these commands
console.log("attachment : " + test);
var test1 = await browser.compose.listAttachments(tab.id);
console.log("attachments : " + test1.toString());
to learn the language a bit better and see what was returned and the return message is:
TypeError: browser.compose.ComposeAttachment is undefined
And listAttachments does not return anything
Complete code :
browser.composeAction.onClicked.addListener(async (tab) => {
var file = new File(["foo"], "foo.pdf", {
type: "application/pdf",
});
console.log("File : " + file);
browser.compose.addAttachment(tab.id, {
file
})
var test = await browser.compose.ComposeAttachment.getFile();
console.log("attachment : " + test);
var test1 = await browser.compose.listAttachments(tab.id);
console.log("attachments : " + test1.toString());
});
Thanks to the research I did, I correctly configured the manifest.json with the compose permission. I would like to know if someone can explain to me how to use these functions in this context.
Best regards
Upvotes: 2
Views: 200