Entering content frame

InfoSource documentation Event API Locate the document in its SAP Library structure

The EPCF event API provides methods for the event handling on the client.

EPCM.subscribeEvent( nameSpace, eventName, eventHandler )

This method assigns an event handler to the specified event.

The method sets the event handler to the subscription list for the event defined by the nameSpace and the eventName. The combination of nameSpace, eventName and eventHandler must be unique. It is not possible to register the same event handler to several events. See chapter Namespaces for more details.

Caution<Insert note icon here>

Isolated iViews have to subscribe on every page Refresh or Reload.

 

Parameter Description

Argument

Type

Description

nameSpace

String

URN of the event namespace.

eventName

String

The event name you subscribe to. You can use an asterisk (*) to subscribe for all events of this name-space.

eventHandler

Function

Reference to the event handler.

Usage

 

<script language ="JavaScript">

    function onWakeup( eventObj ) {

      alert( "got a wakeup call from " +

             eventObj.sourceId + ": " + eventObj.dataObject );

    }

     ...

      EPCM.subscribeEvent( "urn:com.sap:alarmClock",

                           "morningCall", onWakeup );

      ...

      EPCM.subscribeEvent( "urn:com.sap:alarmClock", "*", onWakeup );

<script>

 

 

EPCM.raiseEvent( nameSpace, eventName, dataObject [, sourceId])

This method raises the event defined by nameSpace and eventName. The EPCF service calls all event handlers which are registered for this event and passes the event object on to the event handler.

The event objectis created by the EPCF service whenever an event is raised. It combines the dataObject, the eventName and the sourceId (which may be null) to a single argument for the event handler.

Parameter Description

Argument

Type

Description

nameSpace

String

URN of the event name-space.

eventName

String

The event name with which the event is raised..

dataObject

Object

An object (String, Number, Boolean or Object) that contains a description of the event.

sourceId

(optional)

String

The component id of the event source, for example, the id defined at design-time. Specify Null or no parameter if you do not need the id.

Usage

 

<SCRIPT language ="JavaScript">

    ...

    EPCM.raiseEvent( "urn:com.sap:alarmClock", "morningCall",

           "Good morning ladies and gentlemen", "iView_0815" );

    ...

<SCRIPT>

Leaving content frame