Custom asynchronous operations
Source: Node.js documentationThe simple asynchronous work APIs above may not be appropriate for every scenario. When using any other asynchronous mechanism, the following APIs are necessary to ensure an asynchronous operation is properly tracked by the runtime.
APIs in this section
napi_async_initv1In order to retain ABI compatibility with previous versions, passing NULL for async_resource does not result in an error.napi_async_destroyv1This API can be called even if there is a pending JavaScript exception.napi_make_callbackv1This method allows a JavaScript function object to be called from a native add-on. This API is similar to napi_call_function.napi_open_callback_scopev3There 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 Node-API calls.napi_close_callback_scopev3This API can be called even if there is a pending JavaScript exception.