sk_runtime/frames.rs
1//! The frame clock's wake seam: a producer that wakes the redjs pump also calls [`wake`] to get a frame.
2
3use std::sync::OnceLock;
4
5static WAKER: OnceLock<fn()> = OnceLock::new();
6
7pub fn set_waker(waker: fn()) {
8 let _ = WAKER.set(waker);
9}
10
11/// Asks for a frame at the next refresh. Callable from any thread; a no-op until a host installed its waker.
12pub fn wake() {
13 if let Some(waker) = WAKER.get() {
14 waker();
15 }
16}