Skip to main content

AsyncTaskFinishedCallback

Type Alias AsyncTaskFinishedCallback 

Source
pub type AsyncTaskFinishedCallback = Option<unsafe extern "C" fn(*mut c_void, *mut Dispatchable)>;
Expand description

Callback to notify the embedder that a background task has finished. 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 will be the same as the one given in AsyncTaskStartedCallback. See that callback for more information.

The callback accepts a closure that is the same as the one given by the call to JS::InitAsyncTaskCallbacks.

Aliased Type§

pub enum AsyncTaskFinishedCallback {
    None,
    Some(unsafe extern "C" fn(*mut c_void, *mut Dispatchable)),
}

Variants§

§1.0.0

None

No value.

§1.0.0

Some(unsafe extern "C" fn(*mut c_void, *mut Dispatchable))

Some value of type T.