From 60867fb030bae582082340ead7dbc7efdc2f5398 Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Fri, 3 Apr 2020 02:37:42 -0700 Subject: 2020/04/03, 02:34, v1.2.0 --- node_modules/node-addon-api/doc/callback_scope.md | 54 +++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 node_modules/node-addon-api/doc/callback_scope.md (limited to 'node_modules/node-addon-api/doc/callback_scope.md') diff --git a/node_modules/node-addon-api/doc/callback_scope.md b/node_modules/node-addon-api/doc/callback_scope.md new file mode 100644 index 0000000..35f0f8d --- /dev/null +++ b/node_modules/node-addon-api/doc/callback_scope.md @@ -0,0 +1,54 @@ +# 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. + +```cpp +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. + +```cpp +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. + +```cpp +virtual Napi::CallbackScope::~CallbackScope(); +``` + +### Env + +```cpp +Napi::Env Napi::CallbackScope::Env() const; +``` + +Returns the `Napi::Env` associated with the `Napi::CallbackScope`. + +## Operator + +```cpp +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. -- cgit v1.2.3