Hi Guys,I need to use setInterval method in my application. I know that how to use it in the native script and jquery.But i dont know how to use it in closure.Please help me out this.
Hi Vinod,You probably want goog.Timer, which differs a bit from window.setInterval primarily in that it dispatches events with each tick rather than invoking a single given callback:A simple example:var timer = new goog.Timer(1000);timer.addEventListener(goog.Timer.TICK, function(e) {if (!confirm('Keep ticking?')) {e.target.dispose();}});timer.start();For some higher-level classes that offer extended functionality, see:- http://closure-library.googlecode.com/svn/docs/class_goog_async_Throttle.html (incomplete docs)Usage examples here:Of course, you can always use the native window.<set|clear>Interval methods (which you should reference by full their full namespaces: http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml?showone=Explicit_scope#Explicit_scope), though you won't get the extra sugar.
Cheers,Ross