Hana Dev en
Hana Dev en
Hana Dev en
</script>
264
PUBLI C
</ModulePrefs>
The Site Context API provides the following methods:
publish(key, value): Publish [page 283]
subscribe(callback): Subscribe [page 284]
unsubscribe(subscriptionID): Unsubscribe [page 285]
11.2.4.2.1 Publish
A method of the Site Context API that can be used by a widget to publish a message to other widgets.
publish(key, value)
Use to publish messages to the sapcontext object. A message is a key-value pair that is stored in the context.
The updated context is sent to all subscribed callbacks as a parameter.
A widget can publish multiple values with the same key. Each time a widget publishes a different value with the
same key, the new value replaces the previous one.
Parameters
Parameter Type Description
key String The key of the published pair
value String The value of the published pair
SAP HANA Developer Guide
Building UIs
PUBLI C
</ModulePrefs>
The GadgetPrefs API contains the following methods:
getPreference(key): GetPreference [page 287]
setPreference(key,value): SetPreference [page 289]
11.2.4.3.1 GetPreference
Methods of the GadgetPrefs API that can be used to retrieve a persisted preference of a widget.
getPreference
getPreference(key)
Retrieves the value of a preference specified by its key.
SAP HANA Developer Guide
Building UIs
PUBLI C
</ModulePrefs>
Parameters
Parameter Type Description
title String Title of a widget
Example
<script language ="JavaScript">
...
var newTitle="Hello World";
gadgets.window.setTitle(newTitle);
...
</script>
290
PUBLI C