The opaque data structure containing the environment in which the request is being run.
The Env object is usually created and passed by the Node.js runtime or node-addon-api infrastructure.
Napi::Env::Env(napi_env env);
[in] env
: Thenapi_env
environment from which to construct theNapi::Env
object.
operator napi_env() const;
Returns the napi_env
opaque data structure representing the environment.
Napi::Object Napi::Env::Global() const;
Returns the Napi::Object
representing the environment's JavaScript Global Object.
Napi::Value Napi::Env::Undefined() const;
Returns the Napi::Value
representing the environment's JavaScript Undefined Object.
Napi::Value Napi::Env::Null() const;
Returns the Napi::Value
representing the environment's JavaScript Null Object.
bool Napi::Env::IsExceptionPending() const;
Returns a bool
indicating if an exception is pending in the environment.
Napi::Error Napi::Env::GetAndClearPendingException();
Returns an Napi::Error
object representing the environment's pending exception, if any.
Napi::Value Napi::Env::RunScript(____ script);
[in] script
: A string containing JavaScript code to execute.
Runs JavaScript code contained in a string and returns its result.
The script
can be any of the following types:
Napi::String
const char *
const std::string &