ES6 module constructor’s scope

I’ve stumbled upon a behavior I cannot understand. Could someone, more proficient with JS, have a quick glance at it.

I apologize for posting screenshots instead of setting up a working example here, but I hope it should be enough for an expert to quickly recognize what’s reason is.

  • I have a JS class in an ES6 module
  • I pass a function to the class’ constructor
  • I attach an event handler to an HTMLElement and in this handler I expect to have this function to be accessible.

It’s accessible if I don’t use ES6 modules, I’ve checked. So the reason must be related to the ES6 modules’ scope also I suspect the shadow DOM may be related.

So at this point, line 8 the notifyController function is definedpicture of a browser's console window, function is defined.

But when the event handler is run, it’s undefined.picture of a browser's console window, function is not defined

How come?

Thank you in advance.