Looping inside a widget script

Hi,
Just wondering if it is possible to use a loop in the script area of a widget or will this hang up the UI?

Kind regards,
Chris

I assume you mean an infinite loop, in which case you can use javascript's setInterval which will let the UI thread run between each iteration (an infinite for/while loop would block it):

setInterval(function(){
  // do something
}, 50) // every 50 ms

This is perfect. Many thanks for your answer!