Wrap a js function with a fixed this arg
is there a better way to achieve this functionality?


You can use Function.bind() to create a function with the this context bound to Wyg.Editor:

const node = document.getElementById('myFavoriteNode');
node.addEventListener('click', Wyg.Editor.nodeClickedEvent.bind(Wyg.Editor));


See this demonstrated in the snippet below.

Notice that const was used instead of let - unless there is a reason to re-assign node, use const. This will avoid accidental re-assignment.



const Wyg = {};
Wyg.Editor = class {

    static nodeClickedEvent(event){
        const clickedNode = event.target;
        console.log('nodeClickedEvent() - this: ', this); 
        
    }
};
const node = document.getElementById('myFavoriteNode');
node.addEventListener('click', Wyg.Editor.nodeClickedEvent.bind(Wyg.Editor));
&lt;button id="myFavoriteNode"&gt;click this favorite node&lt;/button&gt;