Google Wave Gadgets API

Robots, Gadgets, Embed »
Pamela Fox

Google Wave
Gadgets API
state callback
state delta
wave.setStateCallback(update);

function update() {
  var keys = wave.getState().getKeys();

  for (var i = 0; i < keys.length; i++) {
    var key = keys[i];
    if (key.match('^vote-')) {
     total += parseInt(wave.getState().get(key));
     count++;
    }
  }
  document.getElementById('total').innerHTML = total;
}
function onClick() {
   wave.getState().submitValue('vote-'  wave.getViewer().getId(), -1);
}

<doc>
 <body>
   <line t="h3"></line>
I am so hungry, I could eat a T-Rex!
   <line></line>
    <w:gadget author="pamelafox@google.com" url="http://plus-one.appspot.com/plus-one.xml" height="43">
    </w:gadget>
  </body>
</doc>
<doc>
 <body>
   <line t="h3"></line>
I am so hungry, I could eat a T-Rex!
   <line></line>
    <w:gadget author="pamelafox@google.com" url="http://plus-one.appspot.com/plus-one.xml" height="43">
    <w:state name="vote-douwe@google.com" value="-1"/>
    </w:gadget>
  </body>
</doc>
Shared State
State XML
State Delta
State Callback

Loading comments...

Please log in to add your comment.

Report abuse

More presentations by Pamela Fox

More prezis by author