pub unsafe extern "C" fn napi_create_promise(
env: napi_env,
deferred: *mut napi_deferred,
promise: *mut napi_value,
) -> napi_statusAvailable on crate feature
napi only.Expand description
Creates a deferred object and an ArkTS promise.
§Arguments
-
env- Current running virtual machine context. -
deferred- The created deferred object which will be passed to ‘napi_resolve_deferred()’ or ‘napi_reject_deferred()’ to resolve or reject the promise. -
promise- The ArkTS promise which is associated with the deferred object.
§Returns
- Returns the function execution status.
[
napi_ok] If the function executed successfully.
[napi_invalid_arg] If env, deferred or resolution is nullptr.
[napi_pending_exception] If an ArkTS exception existed when the function was called.
[napi_generic_failure] If create promise failed.
Available since API-level: 10