@@ -43,6 +43,7 @@ The documentation for N-API is structured as follows:
4343* [Object Wrap][]
4444* [Asynchronous Operations][]
4545* [Promises][]
46+ * [Script Execution][]
4647
4748The N-API is a C API that ensures ABI stability across Node.js versions
4849and different compiler levels. However, we also understand that a C++
@@ -3556,6 +3557,25 @@ NAPI_EXTERN napi_status napi_is_promise(napi_env env,
35563557- `[out] is_promise`: Flag indicating whether `promise` is a native promise
35573558object - that is, a promise object created by the underlying engine.
35583559
3560+ ## Script execution
3561+
3562+ N-API provides an API for executing a string containing JavaScript using the
3563+ underlying JavaScript engine.
3564+
3565+ ### napi_run_script
3566+ <!-- YAML
3567+ added: REPLACEME
3568+ -->
3569+ ```C
3570+ NAPI_EXTERN napi_status napi_run_script(napi_env env,
3571+ napi_value script,
3572+ napi_value* result);
3573+ ```
3574+
3575+ - `[in] env`: The environment that the API is invoked under.
3576+ - `[in] script`: A JavaScript string containing the script to execute.
3577+ - `[out] result`: The value resulting from having executed the script.
3578+
35593579[Promises]: #n_api_promises
35603580[Asynchronous Operations]: #n_api_asynchronous_operations
35613581[Basic N-API Data Types]: #n_api_basic_n_api_data_types
@@ -3565,6 +3585,7 @@ object - that is, a promise object created by the underlying engine.
35653585[Native Abstractions for Node.js]: https://github.com/nodejs/nan
35663586[Object Lifetime Management]: #n_api_object_lifetime_management
35673587[Object Wrap]: #n_api_object_wrap
3588+ [Script Execution]: #n_api_script_execution
35683589[Section 9.1.6]: https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots-defineownproperty-p-desc
35693590[Section 12.5.5]: https://tc39.github.io/ecma262/#sec-typeof-operator
35703591[Section 24.3]: https://tc39.github.io/ecma262/#sec-dataview-objects
0 commit comments