thunderbird / developer-docs

Developer documentation for Thunderbird contributors.
https://developer.thunderbird.net
79 stars 77 forks source link

Missing code in "hello-world" extension tutorial #169

Closed soundlake closed 11 months ago

soundlake commented 11 months ago

Thank you for the good documents, first of all.

This is where I found the problem: https://developer.thunderbird.net/add-ons/hello-world-add-on#popup.js

The code is only

console.log('Hello, World! - from popup.js');

But it says

What our little script does is sending a message to the console each time we click on our "Hello World" toolbar button.

In my humble opinion, there is no click event listener. It is supposed to be something like ...

document
    .getElementsByClassName('popup-page')
    .item(0)
    .addEventListener(
        'click',
        () => console.log('Hello, World! - from popup.js')
    );
jobisoft commented 11 months ago

Hi!

The clickListener is not needed, because the popup.js script is executing its file scope code when the popup is shown (which happens if you click on the browser action button). This is due to the fact, that popup.html is loading popup.js.

soundlake commented 11 months ago

It's my bad. 🙈 I misunderstood clicking the "Hello World" text in the popup instead of the toolbar button.

Thank you for clarifying it.

jobisoft commented 11 months ago

No problem. Feel free to reach out using your communication channels to get more support if needed: https://developer.thunderbird.net/add-ons/community