napi-macros
Advanced tools
Comparing version 1.4.1 to 1.5.0
{ | ||
"name": "napi-macros", | ||
"version": "1.4.1", | ||
"version": "1.5.0", | ||
"description": "Set of utility macros to make writing N-API modules a little easier.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -206,2 +206,31 @@ # napi-macros | ||
#### `NAPI_STATUS_THROWS(call)` | ||
Checks the return status of any `napi_*` function returning a `napi_status` type. This simplifies using a `napi_status` variable and comparing the result with `napi_ok`. It's used internally but can be used stand alone as well. | ||
```c | ||
NAPI_STATUS_THROWS( | ||
napi_create_threadsafe_function( | ||
NULL, | ||
callback, | ||
0, | ||
async_resource_name, | ||
0, | ||
3, | ||
0, | ||
my_finalize, | ||
NULL, | ||
my_callback, | ||
&threadsafe_function | ||
) | ||
); | ||
``` | ||
Above example will fail because the first `env` parameter is `NULL` and throw the following error: | ||
``` | ||
Error: napi_create_threadsafe_function(NULL, callback, 0, async_resource_name, 0, 3, 0, my_finalize, \ | ||
NULL, my_callback, &threadsafe_function) failed! | ||
``` | ||
#### `NAPI_UV_THROWS(err, fn)` | ||
@@ -208,0 +237,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13254
247