sk-runtime 0.3.0

Skathi's JavaScriptCore runtime: context boot, the pump, the bridge and host functions over redjs
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! The frame clock's wake seam: a producer that wakes the redjs pump also calls [`wake`] to get a frame.

use std::sync::OnceLock;

static WAKER: OnceLock<fn()> = OnceLock::new();

pub fn set_waker(waker: fn()) {
    let _ = WAKER.set(waker);
}

/// Asks for a frame at the next refresh. Callable from any thread; a no-op until a host installed its waker.
pub fn wake() {
    if let Some(waker) = WAKER.get() {
        waker();
    }
}