Extending : Widget extension : Advanced topics : Adding ECA support
  
Adding ECA support
UNICOM® Digital Transformation Toolkit (UDTT™) provides ECA tooling to enable a functional developer to handle JavaScript events visually. A technical developer might need to expose the functions or events of a customized widget so that the widget can be used in the ECA tool.
Adding functions for a widget
To add functions to a widget, a technical developer must register them in the widget definition .xml file. The functions can then be used in the ECA tool and be invoked according to ECA rules. Below is a sample function definition:
<function name="setBalance" showInAction="true" showInExpression="true" returnType="Number" description="return balance of account" />
Adding events for a widget
To add events for a widget, a technical developer must register the events in the widget definition .xml file. The events can then be used in the ECA tool and be triggered according to ECA rules. Below is a sample event definition:
<event name="onClick" description="event when button is clicked" />
Monitor ECA execution
UDTT provides ECA execution monitoring so that ECA rule execution tracing messages can be displayed at runtime in a browser console. Because of performance considerations, ECA monitoring is disabled by default. If you want to print rule execution traces during development, enable ECA monitoring by adding the following line into the template file that is used to generate a JSP file from the XUI file.
var BTT_ECA_MONITOR = new com.ibm.btt.event.ConsoleMonitor();
By default, UDTT enables ECA monitoring in the template_debug.jsp template. Developers can choose this template when generating a Dojo page to enable UDTT ECA monitoring.
Sample ECA monitoring output. is a sample output of ECA monitoring in a browser console.
Sample ECA monitoring output
This graphic is described in the surrounding text.
See also
Customizing default monitoring
Advanced topics