Conversation
Implement the timer scheduling system, pulled forward from Phase 4 because it is foundational for many guest app patterns. Callback model: - Guest calls set_timeout(callback_id, delay_ms) or set_interval(callback_id, interval_ms) to schedule timers - Both return a timer ID for cancellation via clear_timer(id) - The host fires expired timers by calling the guest-exported on_timer(callback_id) function each frame, before on_frame(dt_ms) - One-shot timers are removed after firing; intervals reschedule automatically until cleared - Timer resolution is tied to the frame rate (~16ms at 60fps) Host (oxide-browser): - Remove dead_code annotation from TimerEntry and timers field - Add timer_next_id counter to HostState for unique timer IDs - Add drain_expired_timers() utility that collects fired callbacks, removes one-shot timers, and reschedules intervals - Register 3 host functions: api_set_timeout, api_set_interval, api_clear_timer - Extend LiveModule to optionally capture on_timer export and fire expired timers in tick() before the on_frame call - Timer callbacks get their own fuel budget to prevent runaway timers SDK (oxide-sdk): - Add set_timeout(), set_interval(), clear_timer() wrappers Example (examples/timer-demo): - Countdown timer using set_interval (ticks every 1s from 10 to 0) - Delayed message using set_timeout (fires after 3 seconds) - Blinking indicator using set_interval + clear_timer toggle - Stopwatch using 100ms interval with start/stop/reset controls Made-with: Cursor
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Implement the timer scheduling system, pulled forward from Phase 4
because it is foundational for many guest app patterns.