Saturday, August 12, 2006

Google Desktop Gadget - revisited

Adding timer-support was a lot easier than doing the HTML parsing (see My First Google Desktop Gadget ).

Just init with

setInterval(OnTimer, 1000 * 3600 ); // check once every hour

And in function OnTimer() you we just call what we created before.

Same goes for menus; add a refresh menu item like this

plugin.onAddCustomMenuItems = AddCustomMenuItems

function AddCustomMenuItems(menu)
{
  menu.AddItem(strMenuRefresh, 0, OnMenuRefresh);
}
function OnMenuRefresh(item_text)
{
  OnTimer()
}


Easy, isn't it ?

technorati tags:, ,

No comments: