Re:Being recruited in the USA
by jay_kyburz on Wednesday January 04, 2012 @03:02PM
(#3425630)
how do you delay a function to the next tick in javascript?
[ Parent
| on HN ]
That phrasing isn't very precise, but I presume they mean to use setTimeout and pass a timeout of 0 [0]. That link has some discussion of this use and suggests using window.postMessage instead, at least on "modern browsers", for a suitable definition of modern.
Im assuming we are talking client-side and 'next tick' means when there is a millisecond of free time. Just use: setTimeout(function, 0)
Technically supplying '0' as the milliseconds is bad in old browsers, so you might want to say 10...but I've used '0' a lot without fail.