prototype - Delayed start of Ajax.PeriodicalUpdater -
in web-app have statusbar users number of new messages etc shown. use ajax.periodicalupdater
refreshing every 60 sec. periodicalupdater
doing first fetch on initialization when there no need data fresh on page load.
so best practice start updater 60 seconds after page load?
i using window.settimeout
call function starts updater, there better?
function statusbarupdate(){ new ajax.periodicalupdater({ success: 'statusbar' }, '/status', { method: 'get', frequency: 60, decay: 1 }); } window.settimeout("statusbarupdate()", 1000 * 60)
there nothing in ajax.periodicalupdater
's source allows delayed start.
however bit of syntactic sugar last line can neatened:
statusbarupdate.delay(1000 * 60);
Comments
Post a Comment