Raising global events

Hi!

I’m trying to create a global error event handler that shows a modal with the error message, but I’m currently having difficulties when setting up the event.

Just below the <App> tag I have declared <UserEvent ux:Name="globalErrorEvent" /> along with <OnUserEvent EventName="globalErrorEvent" Handler="{handleGlobalErrorEvent}"/>

Then somewhere dark and cozy I execute the handler raiseGlobalErrorEvent : function(){ globalErrorEvent.raise() } and get the following log output:

JS stack trace: ReferenceError: globalErrorEvent is not defined
    at raiseGlobalErrorEvent (Cards/InputCards/User.ux:189:49)
 in Fuse.Reactive.FunctionMirror<Cards/InputCards/User.ux:189>```

It currently works if I, instead of using javascript, use the markup like this
```<Clicked>
      <RaiseUserEvent EventName="globalErrorEvent" />
</Clicked>```

Any suggestions on how I can trigger this directly from javascript?

Hi Palton,

to achieve this you’ll need to use an approach that is shown in this example.