Building custom gadgets : Linking Google gadgets : Linking public Google gadgets
 
Linking public Google gadgets
Google gadgets that the dashboard developer does not own and cannot modify, can receive user selections if the gadget uses the pubsub feature. The dashboard developer adds a script to the import gadget that displays the Google gadget. This script changes the link channel name to match the channel name of the Google gadget. For example, the dashboard developer looks at the XML code of the Google gadget and sees the following code:
gadgets.pubsub.subscribe("MY_PERSONAL_GOOGLE_GADGET", onEventChange);
The channel name used by this Google gadget is MY_PERSONAL_GOOGLE_GADGET.
The dashboard developer then links to a data selection gadget, such as a list gadget, and adds a script to the link settings to match the channel name used in the Google gadget. The following code shows an example of this script, changing the name of the event to MY_PERSONAL_GOOGLE_GADGET.
data.event = "MY_PERSONAL_GOOGLE_GADGET";
When the user makes a selection from the list gadget, the import gadget changes the channel name and passes the message to the Google gadget. For more information about adding script to a linking gadget, see Scripting linked gadgets.