The SDK has sample code for both the gadget API and the search API. The SDK's gadget samples are also available on the web, through an open-source project. Another way to find source code is to unarchive an existing gadget.
It's easy to experiment with JavaScript gadgets.
You can change any file in a gadget or even add files.
You can play with changing images, XML files, or JavaScript code.
Once you're ready to test your changes,
double-click the gadget.gmanifest file
to launch the gadget.
Download the SDK, and you'll find a bunch of sample code, ranging from search actions to a simple HelloWorld gadget to a gadget that plays audio.
The code for the SDK's sample gadgets
is also available on the web,
as part of a Google Code project named
google-desktop-sdk.
You can easily
browse
or search
the source code,
and you can link to individual files.
For example, here's a link to
Audio/main.js.
You can look at the files used in an
existing gadget
by making a copy of the gadget's .gg file,
changing the extension of the copy from
.gg to .zip,
and unzipping the file.
You can find .gg files
for your installed gadgets in
your My Documents\My Google Gadgets folder.