What is the most straight-forward and direct way to queue a task in the browser event loop, using JavaScript?
Things that don't work:
window.setImmediate(func)
: Non-standard.window.setTimeout(func, 0)
/window.setInterval(func, 0)
: Browsers throttle timers to ≥ 4ms.new Promise(r => r()).then(func)
: That queues a microtask, not a task.