napi_cancel_async_work

Function napi_cancel_async_work 

Source
pub unsafe extern "C" fn napi_cancel_async_work(
    env: napi_env,
    work: napi_async_work,
) -> napi_status
Available on crate feature napi only.
Expand description

Cancels queued work if it has not yet been started. If it has already started executing, it cannot be cancelled. If successful, the complete callback will be invoked with a status value of napi_cancelled. The work should not be deleted before the complete callback invocation, even if it has been successfully cancelled.

§Arguments

  • env - Current running virtual machine context.

  • work - The handle returned by the call to napi_create_async_work.

§Returns

  • Returns the function execution status. [napi_ok] If the function executed successfully.

[napi_invalid_arg] If the param env and(or) work is nullptr.

Available since API-level: 10