Hello everyone,
In our custom components I am trying to integrate the event listener so I can switch to dark or light mode depending on what mode our application is in. But the code, which the documentation suggests, does not seem to work. I did the following:

This is, aside from a few console.warn statements, a copy from what is in the TW docs.
This is the suggestion from the TW docs with a few console.warns added so every log pops out.
And this is the output of this bit of code:

As you can see it does not get into the window.addEventListener. But if I change it to the following I get another result:

The result is as follows:

It does more, it gives me the console.warns I was after, but I don't get the TW status, which I was expecting. I am fairly certain I am doing something wrong somewhere, what could it be, as I am out of ideas.





