settle
Processes pending microtasks and timer callbacks to drain the JavaScript event loop. Use after DOM modifications or eval to ensure scheduled callbacks are executed.
Instructions
Drain the JS event loop: alternately runs queued microtasks (Promise resolutions) and fires expired setTimeout/setInterval callbacks, sleeping to the next deadline when only timers remain. Returns when the queue is empty OR max_ms elapses OR max_iters iterations complete. Defaults: max_ms=2000, max_iters=50. Use after seeding the DOM (or after eval'd code that schedules timers) to let pending callbacks run.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max_iters | No | Max iterations of the drain loop (default 50) | |
| max_ms | No | Max wall-clock ms to spend (default 2000) |