Introduction to Google Wave Gadget and and Robot APIs. Presentation given May 26, 2010 at the National Extension Technology Conference in Auburn, Alabama. War Eagle!
7. Blip Anatomy (cont.)
Document
Annotations
Children
Parent (if not already)
metadata
creator
contributors
last_modified
version
8.
9. Gadgets: n, dynamic web content that
can be placed on any page on the web.
Gadgets can be games, mini
applications, news feeds, maps or any
content.
See also: JavaScript on steroids.
14. <script type="text/javascript">
var div = $('content_div');
function init() {
if (wave &&
wave.isInWaveContainer()) {
wave.setStateCallback(stateUpdated);
}
}
gadgets.util.registerOnLoadHandler(init);
15. function buttonClicked() {
var val = wave.getState().get('count', '0');
wave.getState().submitDelta(
{'count': val + 1});
}
function stateUpdated() {
if (!wave.getState().get('count')) {
div.innerHTML = "The count is 0."
} else {
div.innerHTML = "The count is " +
wave.getState().get('count');
}
}
16. // Reset value of "count" to 0
function resetCounter(){
wave.getState().submitDelta({'count': '0'});
}
</script>
]]>
</Content>
</Module>
31. Robot Annotations
def OnWaveletSelfAdded(event, wavelet):
blip = event.blip
blip.Annotation("my-robot/tag")
def OnButtonClicked(event, wavelet):
blip = event.blip
annots = blip.annotations
if annots.include("my-robot/tag"):
""" do MY robot stuff """
32. Active Robot API
Performing scheduled tasks (e.g. cron
jobs) at specified intervals
Creating new waves within Google Wave
in response to actions within Google Wave
itself
Responding to outside events or services
by updating waves or creating new ones