Implement timer APIs: setTimeout, setInterval, requestAnimationFrame
- Add timers.rs module with thread-local timer registry, ID generation,
and timer lifecycle management (schedule, cancel, take due timers)
- Register global functions: setTimeout, clearTimeout, setInterval,
clearInterval, requestAnimationFrame, cancelAnimationFrame
- Integrate timer execution with VM event loop: drain_due_timers runs
after microtasks, pump_event_loop and run_event_loop for external use
- Timer callbacks registered as GC roots to survive garbage collection
- Microtask queue drains after each timer callback (Promise integration)
- 15 tests covering: ID generation, deferred execution, cancellation,
interval repetition, requestAnimationFrame timestamps, GC survival,
Promise-timer interaction, edge cases
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
authored by
tangled.org
7ebfb8ec
ae1a1c03