|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public EventService
This interface defines iWidget EventService which provides a topic driven subscribe/publish mechanism. "fireEvent" and "broadcastEvent" are provided as convenience functions on top of this basic model. The service can be retrieved using the following code:
var eventService = com.ibm.mashups.services.ServiceManager.getService(
com.ibm.mashups.iwidget.services.EventService.SERVICE_NAME);
Field Summary | |
---|---|
String |
SERVICE_NAME
The service name to be used to fetch the service from the ServiceManager |
Method Summary | |
---|---|
void |
fireEvent(String targetWidget,
String targetEvent,
Object payload,
String payloadType,
String sourceid)
Allows page component to invoke a handled event that's defined in an iWidget. |
void |
broadcastEvent(String targetEvent,
Object payload,
String payloadType,
String sourceid)
Allows page components to broadcast an event to all the widgets/components on the page. |
void |
broadcastEvent(String targetEvent,
Object payload,
String payloadType,
String sourceid,
String pageid)
Allows page components to switch to a different page and broadcast an event to all the widgets/components on that page. |
void |
broadcastEvent(String targetEvent,
Object payload,
String payloadType,
String sourceid,
String pageid,
String spaceid)
Allows page components to switch to a different page and space and broadcast an event to all the widgets/components on that page. |
void |
broadcastEvents(Array eventsArray,
String sourceid)
Allows page components to broadcast more than one event to all the widgets/components on the page. |
void |
broadcastEvents(Array eventsArray,
String sourceid,
String pageid)
Allows page components to switch to a different page and broadcast more than one event to all the widgets/components on that page. |
void |
broadcastEvents(Array eventsArray,
String sourceid,
String pageid,
String spaceid)
Allows page components to switch to a different page and space and broadcast more than one event to all the widgets/components on that page. |
void |
publishEvent(String topic,
Object payload,
String payloadType,
String sourceid)
Allows page component to publish a global event that's available to all the other page components. |
void |
subscribeEvent(String event,
Object object,
String eventCallback,
String subscribeCallback,
String sourceid)
Allows page component to subscribe a global event that's available to all the other page components. |
void |
unsubscribeEvent(Object subscriptionHandler,
String sourceid)
Allows page component to unsubscribe a global event that's available to all the other page components. |
Field Detail |
---|
String SERVICE_NAME
Method Detail |
---|
void fireEvent(String targetWidget, String targetEvent, Object payload, String payloadType, String sourceid)
com.ibm.mashups.services.ServiceManager.getService("eventService").fireEvent(this.iwidgetId,"onModeChanged",
{
newMode:"view"});
com.ibm.mashups.services.ServiceManager.getService("eventService").publishEvent("widgetevents."+this.iwidgetId+"."+"onModeChanged",
{
newMode:"view"});
targetWidget
-
id of target iWidget. Must never be NULL.targetEvent
-
event name of target Event .Must never be NULL.payload
-
optional. data object that's distributed with an event. May be NULL.payloadType
-
optional. type of the payloadsourceid
-
optional. id of source component that triggers this eventvoid broadcastEvent(String targetEvent, Object payload, String payloadType, String sourceid)
<iw:event id="pageModechanged" eventDescName="pageModeChanged_desc" handled="true" onEvent="handlePageModeChange" />
serviceManager.getService("eventService").subscribeEvent ("pageModechanged",handlerFn,scope,sourceid)
com.ibm.mashups.services.ServiceManager.getService("eventService").broadcastEvent("pageModeChanged", payload,payloadtype,,sourceid);
com.ibm.mashups.services.ServiceManager.getService("eventService").publishEvent("*"+"."+"onModeChanged",
{
newMode:"view"});
targetEvent
-
event name of target Event .Must never be NULL.payload
-
optional. data object that's distributed with an event. May be NULL.payloadType
-
optional. type of the payloadsourceid
-
optional. id of client component that triggers this event.void broadcastEvent(String targetEvent, Object payload, String payloadType, String sourceid, String pageid)
targetEvent
-
event name of target Event .Must never be NULL.payload
-
optional. data object that's distributed with an event. May be NULL.payloadType
-
optional. type of the payloadsourceid
-
optional. id of client component that triggers this event.pageid
-
optional. id of page to switch to and receive the event. If none is provided, no page switch will occur and event will broadcast to current page.void broadcastEvent(String targetEvent, Object payload, String payloadType, String sourceid, String pageid, String spaceid)
targetEvent
-
event name of target Event .Must never be NULL.payload
-
optional. data object that's distributed with an event. May be NULL.payloadType
-
optional. type of the payloadsourceid
-
optional. id of client component that triggers this event.pageid
-
optional. id of page to switch to and receive the event. If none is provided, no page switch will occur and event will broadcast to current page.spaceid
-
optional. id of space containing the page to switch to and receive the event. If none is provided, current space is assumed.void broadcastEvents(Array eventsArray, String sourceid)
eventsArray
-
Array of objects each containing the following event information: { "targetEvent": targetEvent, "payload": payload, "payloadType": payloadType }. Must never be NULL.sourceid
-
optional. id of client component that triggers this event.void broadcastEvents(Array eventsArray, String sourceid, String pageid)
eventsArray
-
Array of objects each containing the following event information: { "targetEvent": targetEvent, "payload": payload, "payloadType": payloadType }. Must never be NULL.sourceid
-
optional. id of client component that triggers this event.pageid
-
optional. id of page to switch to and receive the events. If none is provided, no page switch will occur and events will broadcast to current page.void broadcastEvents(Array eventsArray, String sourceid, String pageid, String spaceid)
eventsArray
-
Array of objects each containing the following event information: { "targetEvent": targetEvent, "payload": payload, "payloadType": payloadType }. Must never be NULL.sourceid
-
optional. id of client component that triggers this event.pageid
-
optional. id of page to switch to and receive the events. If none is provided, no page switch will occur and events will broadcast to current page.spaceid
-
optional. id of space containing the page to switch to and receive the events. If none is provided, current space is assumed.void publishEvent(String topic, Object payload, String payloadType, String sourceid)
topic
-
topic that's published.Must never be NULL.payload
-
optional. payload object.payloadType
-
optional. type of the payloadsourceid
-
optional. id of client component that triggers this event.void subscribeEvent(String event, Object object, String eventCallback, String subscribeCallback, String sourceid)
event
-
event nameobject
-
optional. scope object of the handlerFn. default scope is global scope.eventCallback
-
optional. eventCallback that will be invoked when event is publishedsubscribeCallback
-
optional. callback to tell is subscription is goodsourceid
-
optional. id of client component that subscribes this eventvoid unsubscribeEvent(Object subscriptionHandler, String sourceid)
subscriptionHandler
-
subscriptionHandlersourceid
-
optional. id of client component that subscribes this event
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |