Responsible for the communication between different window objects.
This class is a singleton. The class instance can be retrieved as follows:
new sap.ui.core.postmessage.Bus()
sap.ui.core.postmessage.Bus.getInstance()
For supported data types for payload messages, see https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
.
Method | Description |
---|---|
sap.ui.core.postmessage.Bus.extend |
Creates a new subclass of class sap.ui.core.postmessage.Bus with name
|
sap.ui.core.postmessage.Bus.getInstance |
Returns an instance of the class. |
sap.ui.core.postmessage.Bus.getMetadata |
Returns a metadata object for class sap.ui.core.postmessage.Bus. |
publish |
Publish message into cross-window communication channel |
subscribe |
Attaches an event handler to the event with the given identifier on the given event channel |
Creates a new subclass of class sap.ui.core.postmessage.Bus with name sClassName
and enriches it with the information contained in oClassInfo
.
oClassInfo
might contain the same kind of information as described in sap.ui.core.EventBus.extend.
Param | Type | DefaultValue | Description |
---|---|---|---|
sClassName | string |
Name of the class being created |
|
oClassInfo | object |
Object literal with information about the class |
|
FNMetaImpl | function |
Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class |
Returns a metadata object for class sap.ui.core.postmessage.Bus.
Publish message into cross-window communication channel
Param | Type | DefaultValue | Description |
---|---|---|---|
mParameters | object |
Map with params |
|
target | Window |
Window object of receiving window |
|
origin | string |
Origin of the receiving window, e.g. http://example.com |
|
channelId | string |
Channel identifier |
|
eventId | string |
Event identifier |
|
data | any |
Payload data. For supported data types see - https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
|
Attaches an event handler to the event with the given identifier on the given event channel
Param | Type | DefaultValue | Description |
---|---|---|---|
sChannelId | string |
Channel of the event to subscribe to. If not given, the default channel is used. The channel |
|
sEventId | string |
Identifier of the event to listen for |
|
fnFunction | function |
Handler function to call when the event occurs; this function is called in the context of the - {string} sChannelId - Channel ID - {string} sEventId - Event ID - {object} mParameters - Event parameters - {Event} originalEvent - Post message original event - {string} channelId - Channel ID - {string} eventId - Event ID - {Window} source - Sender window - {string} origin - Sender origin, e.g. https://example.com - {*} [data] - Payload data |
|
oListener | object |
Object that wants to be notified when the event occurs ( |