How to use the UserEvent?

I need to call a js function from a click with parameter. So I guess the way to do this is to use UserEvent (though it would be super useful to be able to give a parameter to ), but I’m having hard time to get it working. Documentation doesn’t help me to understand this.

I have a <UserEvent Name="MyEvent”/> inside

and I have

    <RaiseUserEvent Name="MyEvent">
        <UserEventArg Name="message" StringValue="Hello from UX!" />
    </RaiseUserEvent>

 </Clicked>

inside my element, that should call the function with parameter when it’s clicked.

Where should I place the event listener ? This cannot be added inside App and if I add it to some Panel in my MainView the function isn’t called.

My javascript part is simply:

var MyFunction = function(args) {

    console.log("MyFunction "+args.message);

}

module.exports.MyFunction = MyFunction;

Please enlighten me what I’m doing wrong here?

This actually works. It was the monitor that was doing tricks on me. Never trust that dude!