Gadget Design
Even though Google Wave gadgets and generic Google gadgets share similar structure and functionality, some design considerations are specific to Google Wave gadgets. The following sections serve to highlight some of the design considerations that you may want to consider as you start developing gadgets. They’re based in part on the “Google Wave Gadgets API Reference” documentation (http://code.google.com/apis/wave/extensions/gadgets/reference.html).
Programming Logic
Developing gadgets is fairly straightforward. However, you should take the following considerations into account for the programming logic you will use with gadgets.
Do not attempt to access objects during initialization
Gadgets rely on callbacks for a variety of things,
including the initial function processed when a gadget is added to a
wave. The gadgets.util.registerOnLoadHandler(init) method
is used to declare the initial function (in this case the function is
named init).
Because a wave’s state and participants do not have any
accessible values until their callbacks have fired, you should refrain
from attempting to access these objects within the initial function.
Instead, register callback functions within the initial function using
the appropriate callback methods (wave.setStateCallback
and wave.setParticipantCallback). This will ensure that
your code does not run into any issues trying to apply methods to
undefined objects.
Most of the logic should be inside of callbacks
Your code should rely on relevant ...