callback to gadgets.util.registerOnLoadHandler is event that notify that gadget infrastructure and it's container is ready. thus you can set handlers to perform communication with parent window: set gadget's height, get stored state
gadget wave api is also using that handler to do it's internal init: /** * Internal initialization. */ wave.internalInit_ = function() { wave.checkWaveContainer_(); if (wave.isInWaveContainer()) { gadgets.rpc.register('wave_participants', wave.receiveWaveParticipants_); gadgets.rpc.register('wave_gadget_state', wave.receiveState_); gadgets.rpc.register('wave_state_delta', wave.receiveStateDelta_); gadgets.rpc.register( 'wave_private_gadget_state', wave.receivePrivateState_); gadgets.rpc.register( 'wave_private_state_delta', wave.receivePrivateStateDelta_); gadgets.rpc.register('wave_gadget_mode', wave.receiveMode_); gadgets.rpc.call(null, 'wave_enable', null, '1.0'); } }; /** * Sets up the wave gadget variables and callbacks. */ (wave.init_ = function() { if (window['gadgets']) { gadgets.util.registerOnLoadHandler(function() { wave.internalInit_(); }); } })(); at that time wave api initialize state object but it's null and then it registers to opensocial rpc listeners which will transfer state deltas, participants, etc. and only after that it will be able to receive any data In my practice and according to wave api's asynchronous model you shouldn't perform state actions until setStateCallback is fired for state and setParticipantCallback for participants On Wednesday, January 16, 2013 4:59:36 PM UTC+7, Zachary Yaro wrote: > > Why then would it happen in the gadgets.util.registerOnLoadHandler > callback? The impression I got is that should not fire until the gadget > has been fully loaded. > > —Zachary “Gamer_Z.” Yaro > > > On 16 January 2013 02:42, Serj <k.y.s...@gmail.com <javascript:>> wrote: > >> I don't think that this behavior is bug. This just means that at that >> moment gadget haven't receive it's state yet. >> >> >> On Wednesday, January 16, 2013 1:43:10 PM UTC+7, Zachary Yaro wrote: >>> >>> Funny enough, years later, I am now seeing this bug for the first time >>> (in Chrome, in both Rizzoma and Wave-In-A-Box). I know it was a while ago, >>> but did you ever find a solution? >>> >>> —Zachary “Gamer_Z.” Yaro >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Google Wave API" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/google-wave-api/-/sYVnqUVNzOsJ. >> >> To post to this group, send email to google-...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> google-wave-a...@googlegroups.com <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/google-wave-api?hl=en. >> > > -- You received this message because you are subscribed to the Google Groups "Google Wave API" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-wave-api/-/XRSPoc0WZCsJ. To post to this group, send email to google-wave-api@googlegroups.com. To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en.