My favorites | English | Sign in

Google Wave API (Labs)

WaveProtocol.org

Learn about the Google Wave Federation Protocol and get involved

Google Wave Gadgets API Reference

Note: Some functionality may only be available in the latest release of the Wave Gadgets library. To use that release, include <Require feature="wave-preview"> in your gadget instead of <Require feature="wave">.

namespace wave

This namespace defines the top level wave object within the Wave Gadgets API.

Static Methods

Static Methods Return Value Description
getHost() wave.Participant Returns the Participant who added this gadget to the blip. Note that the host may no longer be in the participant list.
getMode() wave.Mode Returns the gadget wave.Mode.
getParticipantById(id:String) wave.Participant Returns a Participant with the given id.
getParticipants() Array.<wave.Participant> Returns a list of Participants on the Wave.
getState() wave.State Returns the gadget wave.State object.
getTime() number Retrieves "gadget time" which is either the playback frame time in the playback mode or the current time otherwise.
getViewer() wave.Participant Get the Participant whose client renders this gadget.
isInWaveContainer() Boolean Indicates whether the gadget runs inside a wave container.
log(message:String) None Requests the container to output a log message.
setModeCallback(callback:Function, opt_context?:Object) None Sets the mode change callback.
setParticipantCallback(callback:Function, opt_context?:Object) None Sets the participant update callback. If the participant information is already received, the callback is invoked immediately to report the current participant information. Only one callback can be defined. Consecutive calls would remove the old callback and set the new one.
setStateCallback(callback:Function, opt_context?:Object) None Sets the gadget state update callback. If the state is already received from the container, the callback is invoked immediately to report the current gadget state. Only callback can be defined. Consecutive calls would remove the old callback and set the new one.

class Callback

This class is an immutable utility class for handlings callbacks with variable arguments and an optional context.

Constructor

Constructor Description
wave.Callback(callback:function, opt_context:Object) Constructs a wave.Callback given the provided callback function and an optional context.

Methods

Methods Return Value Description
invoke(var_args:Array) None Invokes the callback method with any arguments passed

class Mode

Identifiers for wave modes

Constant

Constant Description
UNKNOWN The blip containing the gadget is in an unknown mode. In this case, you should not attempt to edit the blip.
VIEW The blip containing the gadget is in view, but not edit mode.
EDIT The blip containing the gadget is in edit mode.
DIFF_ON_OPEN The blip containing the gadget has changed since the last time it was opened and the gadget should notify this change to the user.
PLAYBACK The blip containing the gadget is in playback mode.

class Participant

This class specifies participants on a wave.

Note: Participant information can be dynamically updated (except for IDs). This includes the thumbnail URL, display name, and any future extensions to the participant. Instead of storing this information, gadgets should update displayed participant data each time they receive a participant callback.

Constructor

Constructor Description
wave.Participant() Constructs a wave.Participant.

Methods

Methods Return Value Description
getDisplayName() String Gets the human-readable display name of this participant.
getId() String Gets the unique identifier of this participant.
getThumbnailUrl() String Gets the url of the thumbnail image for this participant.

class State

This class contains state properties of the Gadget.

Constructor

Constructor Description
wave.State() Constructs a wave.State.

Methods

Methods Return Value Description
get(key:String, opt_default?:String) String|null Retrieve a value from the synchronized state. As of now, get always returns a string. This will change at some point to return whatever was set.
getKeys() Array. Retrieve the valid keys for the synchronized state.
reset() None Submits a delta to remove all key-values in the state.
submitDelta(delta:Object) None Updates the state delta. This is an asynchronous call that will update the state and not take effect immediately. Creating any key with a null value will attempt to delete the key.
submitValue(key:String, value:String) None Submits delta that contains only one key-value pair. Note that if value is null the key will be removed from the state. See submitDelta(delta) for semantic details.
toString() Pretty prints the current state object. Note this is a debug method only.

namespace wave.util

This namespace defines utility methods for use within the Wave Gadgets API.

Static Methods

Static Methods Return Value Description
printJson(obj:Object, opt_pretty?:boolean, opt_tabs?:number) string Outputs JSON objects in text format. Optionally pretty print.

Back to top