Skip to main content

InitAsyncTaskCallbacks

Function InitAsyncTaskCallbacks 

Source
pub unsafe extern "C" fn InitAsyncTaskCallbacks(
    cx: *mut JSContext,
    dispatchCallback: Option<unsafe extern "C" fn(*mut c_void, *mut u8) -> bool>,
    delayedDispatchCallback: Option<unsafe extern "C" fn(*mut c_void, *mut u8, u32) -> bool>,
    asyncTaskStartedCallback: Option<unsafe extern "C" fn(*mut c_void, *mut Dispatchable)>,
    asyncTaskFinishedCallback: Option<unsafe extern "C" fn(*mut c_void, *mut Dispatchable)>,
    closure: *mut c_void,
)
Expand description

Initialize the async task callbacks. Embedders must use this or else call js::UseInternalJobQueues to select a default implementation built into SpiderMonkey. This latter depends on the embedding to call js::RunJobs on the JavaScript thread to process queued Dispatchables at appropriate times.

The dispatchCallback and delayedDispatchCallback are mandatory. asyncTaskStartedCallback and asyncTaskFinishedCallback are optional and may be null.