google-gadgetgoogle-wave

Google Wave Gadget: gadgets.window is undefined


I'm learning Google Wave gadgets.

I'm trying to force my gadget to resize itself.

But I'm keep getting error that gadgets.window is undefined.

Here is my gadget:

<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
<ModulePrefs title="GitHub Gist Gadget">
  <Require feature="wave" /> 
  <!--Require feature="locked-domain" /-->
  <Require feature="dynamic-heights" />
</ModulePrefs>
<Content type="html">
<![CDATA[ 
<div id="content_div"> 

<input type=button onclick="gadgets.window.adjustHeight()" />

<script src="http://gist.github.com/244697.js"></script>

<script type="text/javascript">
  gadgets.window.adjustHeight()
</script>

</div>
  ]]> 
  </Content>
</Module>

BTW, if you know about gadget to embed GitHub gists into Google Waves, please tell me. :-)


Solution

  • replace dynamic-heights with dynamic-height.

    gadgets.window.adjustHeight() should be replaced with gadgets.util.registerOnLoadHandler(gadgets.window.adjustHeight), becouse gadgets.window may be not loaded while you initialize gadget.