GeezerVison is showing github.com — doc: update napi_async_init documentation · nodejs/node@cf88ed8
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: doc/api/n-api.md +6-1Lines changed: 6 additions & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4672,8 +4672,13 @@ napi_status napi_async_init(napi_env env, |
4672 | 4672 | ``` |
4673 | 4673 |
|
4674 | 4674 | * `[in] env`: The environment that the API is invoked under. |
4675 | | -* `[in] async_resource`: An optional object associated with the async work |
| 4675 | +* `[in] async_resource`: Object associated with the async work |
4676 | 4676 | that will be passed to possible `async_hooks` [`init` hooks][]. |
| 4677 | + In order to retain ABI compatibility with previous versions, |
| 4678 | + passing `NULL` for `async_resource` will not result in an error, however, |
| 4679 | + this will result incorrect operation of async hooks for the |
| 4680 | + napi_async_context created. Potential issues include |
| 4681 | + loss of async context when using the AsyncLocalStorage API. |
4677 | 4682 | * `[in] async_resource_name`: Identifier for the kind of resource |
4678 | 4683 | that is being provided for diagnostic information exposed by the |
4679 | 4684 | `async_hooks` API. |
|