BTT Web 2.0 On-Demand Workplace implements communication between components through the event mechanism. The event mechanism consists of two main modules, event manager and event. As an asynchronous communication approach, event mechanism makes the transfer of message between different modules convenient and effective.
The following picture shows the structure of BTT Web 2.0 On-Demand Workplace event:
The following diagram shows the code of event mechanism:
An event manager acts as the event controller between notifiers and handlers to manage communication between components. It is named as BTTEventMng in BTT Web 2.0 On-Demand Workplace. When you need to publish an event, subscribe an event, or fire an event, you can call the corresponding methods of the event manager. The manager is the core of BTT event mechanism.
Event is an inner data structure representing an event identified by a string (event name). In BTT Web 2.0 On-Demand Workplace, event module is named BTTEvent, which represents an event instance. When you publish or register an event by addEvents(eventName, one BTTEvent instance is created. You can add listeners in the BTTEvent instance and invoke it in BTTEventMng.