mirror of https://github.com/nodejs/node.git
n-api: rename 'promise' parameter to 'value'
This change makes it clear that the value doesn't need to be a Promise, and makes the signature consistent with other napi_is_* functions. PR-URL: https://github.com/nodejs/node/pull/31544 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>pull/31321/head
parent
dd4c62eabe
commit
a171314003
|
@ -4994,12 +4994,12 @@ napiVersion: 1
|
|||
|
||||
```C
|
||||
napi_status napi_is_promise(napi_env env,
|
||||
napi_value promise,
|
||||
napi_value value,
|
||||
bool* is_promise);
|
||||
```
|
||||
|
||||
* `[in] env`: The environment that the API is invoked under.
|
||||
* `[in] promise`: The promise to examine
|
||||
* `[in] value`: The value to examine
|
||||
* `[out] is_promise`: Flag indicating whether `promise` is a native promise
|
||||
object (that is, a promise object created by the underlying engine).
|
||||
|
||||
|
|
|
@ -440,7 +440,7 @@ NAPI_EXTERN napi_status napi_reject_deferred(napi_env env,
|
|||
napi_deferred deferred,
|
||||
napi_value rejection);
|
||||
NAPI_EXTERN napi_status napi_is_promise(napi_env env,
|
||||
napi_value promise,
|
||||
napi_value value,
|
||||
bool* is_promise);
|
||||
|
||||
// Running a script
|
||||
|
|
|
@ -2999,13 +2999,13 @@ napi_status napi_reject_deferred(napi_env env,
|
|||
}
|
||||
|
||||
napi_status napi_is_promise(napi_env env,
|
||||
napi_value promise,
|
||||
napi_value value,
|
||||
bool* is_promise) {
|
||||
CHECK_ENV(env);
|
||||
CHECK_ARG(env, promise);
|
||||
CHECK_ARG(env, value);
|
||||
CHECK_ARG(env, is_promise);
|
||||
|
||||
*is_promise = v8impl::V8LocalValueFromJsValue(promise)->IsPromise();
|
||||
*is_promise = v8impl::V8LocalValueFromJsValue(value)->IsPromise();
|
||||
|
||||
return napi_clear_last_error(env);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue