Skip to main content

InitAsyncTaskCallbacks

Function InitAsyncTaskCallbacks 

Source
pub unsafe extern "C" fn InitAsyncTaskCallbacks(
    cx: *mut JSContext,
    dispatchCallback: DispatchToEventLoopCallback,
    delayedDispatchCallback: DelayedDispatchToEventLoopCallback,
    asyncTaskStartedCallback: AsyncTaskStartedCallback,
    asyncTaskFinishedCallback: AsyncTaskFinishedCallback,
    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.