title: Is there a correct way to 'yield' in the cooperative threading sense in javascript?
body: <p>I'm writing a ubiquity plugin the long function callback for an ajax query is blocking up the GUI Thread causing firefox to lock up. </p>
  
  <p>The obvious solution seem to be to use some sort of deferred execution of (i.e we want to periodically add the <strong>carry out doing this query</strong> function to the end of the event queue and then allow other commands to be carried out.</p>
  
  <p>The only way I can think of doing this is to use settimeout with a timeout of zero... is this is guaranteed to work, or is there a better way of doing this.</p>