1.3 KiB
1.3 KiB
CallbackScope
There are cases (for example, resolving promises) where it is necessary to have the equivalent of the scope associated with a callback in place when making certain N-API calls.
Methods
Constructor
Creates a new callback scope on the stack.
::CallbackScope::CallbackScope(napi_env env, napi_callback_scope scope); Napi
[in] env
: The environment in which to create theNapi::CallbackScope
.[in] scope
: The pre-existingnapi_callback_scope
orNapi::CallbackScope
.
Constructor
Creates a new callback scope on the stack.
::CallbackScope::CallbackScope(napi_env env, napi_async_context context); Napi
[in] env
: The environment in which to create theNapi::CallbackScope
.[in] async_context
: The pre-existingnapi_async_context
orNapi::AsyncContext
.
Destructor
Deletes the instance of Napi::CallbackScope
object.
virtual Napi::CallbackScope::~CallbackScope();
Env
::Env Napi::CallbackScope::Env() const; Napi
Returns the Napi::Env
associated with the
Napi::CallbackScope
.
Operator
::CallbackScope::operator napi_callback_scope() const; Napi
Returns the N-API napi_callback_scope
wrapped by the
Napi::CallbackScope
object. This can be used to mix usage
of the C N-API and node-addon-api.