1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-14 03:30:18 +00:00
musix-oss/node_modules/node-addon-api/doc/callback_scope.md
2020-03-04 13:43:21 +02:00

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.

Napi::CallbackScope::CallbackScope(napi_env env, napi_callback_scope scope);
  • [in] env: The environment in which to create the Napi::CallbackScope.
  • [in] scope: The pre-existing napi_callback_scope or Napi::CallbackScope.

Constructor

Creates a new callback scope on the stack.

Napi::CallbackScope::CallbackScope(napi_env env, napi_async_context context);
  • [in] env: The environment in which to create the Napi::CallbackScope.
  • [in] async_context: The pre-existing napi_async_context or Napi::AsyncContext.

Destructor

Deletes the instance of Napi::CallbackScope object.

virtual Napi::CallbackScope::~CallbackScope();

Env

Napi::Env Napi::CallbackScope::Env() const;

Returns the Napi::Env associated with the Napi::CallbackScope.

Operator

Napi::CallbackScope::operator napi_callback_scope() const;

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.