ResponseHandler

(This tag must be placed inside a <Dispatcher> tag)

The ResponseHandler tag can be used to receive a response from an event that was dispatched from a dispatcher instance. After dispatching an event using the Dispatcher tag, the view that dispatched this event can receive a response. Those responses are sent from the EventMap within the EventHandlers block that was listening for the event dispatched by the Dispatcher.

It's important to note that this response will be received only by the view instance that dispatched the event, even if there are other instances of the same view or other views dispatch the same event.

<mate:Dispatcher>

   <mate:ResponseHandler type="searchCustomerResult" response="onSearchResultReceived(event.mySearchResult)" />
   
</mate:Dispatcher>

Responses are handled by either the response event handler or by the method attribute. The response event handler allows you to write inline code. If you use the method attribute, you must implement a method that receives an event (either a custom event or a DynamicEvent).

Attributes

type

Type of the event that this ResponseHandler is listening to. This type needs to match the ResponseAnnouncer type defined in the ListenerSequence in the EventMap.

response

either response or method must be specified

Event handler that receives the "response". The event received is triggered by a ResponseAnnouncer created in the EventMap. This event will contain any properties set in the ResponseAnnouncer by using the Properties tag.

method

either response or method must be specified

Method that will handle the response event. It must accept a custom event (or Event that can be casted within the method) or a DynamicEvent.

0 responses so far

Leave a response

If you need help or want to comment on something not related to this page, please post in the forums. Thanks!

Leave this field empty