Hacker News new | ask | show | jobs
by eric_h 4208 days ago
setTimeout with no timeout argument simply schedules the provided function for when the interpreter is next idle. Underscore.js wraps a similar unqualified call in _.defer (last i checked, anyway; they might now provide it with a very small number or 0 for the timeout).

Edit: in both cases the result is the same in most browsers.

1 comments

It's clamped to 4. You can't go lower than that.

There is `setImmediate` for making something run the very next cycle. However, only IE10+ supports it and the other browser vendors are against it. You can use abuse `postMessage` to get a similar effect.