pub type AsyncTaskStartedCallback = Option<unsafe extern "C" fn(*mut c_void, *mut Dispatchable)>;Expand description
Callback to notify the embedder that a background task has begun. This can be used to keep the JSContext’s thread alive if it’s subject to garbage collection (e.g. as web workers are).
This callback will be called on the same thread as the JSContext, but it must not perform any garbage collection or re-enter the engine.
The passed dispatchable can be used to track the async task. Most async tasks will finish in a bounded amount of time, but some (i.e. Atomics.waitAsync) are not guaranteed to finish. These tasks may be canceled using JS::CancelAsyncTasks.
The callback accepts a closure that is the same as the one given by the call to JS::InitAsyncTaskCallbacks.
Aliased Type§
pub enum AsyncTaskStartedCallback {
None,
Some(unsafe extern "C" fn(*mut c_void, *mut Dispatchable)),
}