doc: add inline comment hints on finalizer signatures (#1738) · nodejs/node-addon-api@4be1e86 · GitHub
Skip to content

Commit 4be1e86

Browse files
authored
doc: add inline comment hints on finalizer signatures (#1738)
1 parent 5a8e285 commit 4be1e86

5 files changed

Lines changed: 49 additions & 16 deletions

File tree

‎doc/basic_env.md‎

Lines changed: 6 additions & 5 deletions

‎doc/external.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ Returns the created `Napi::External<T>` object.
3535
3636
```cpp
3737
template <typename T>
38-
static Napi::External Napi::External::New(napi_env env,
39-
T* data,
40-
Finalizer finalizeCallback);
38+
template <typename Finalizer>
39+
static External New(napi_env env, T* data, Finalizer finalizeCallback);
4140
```
4241

4342
- `[in] env`: The `napi_env` environment in which to construct the `Napi::External` object.
@@ -52,7 +51,8 @@ Returns the created `Napi::External<T>` object.
5251

5352
```cpp
5453
template <typename T>
55-
static Napi::External Napi::External::New(napi_env env,
54+
template <typename Finalizer, typename Hint>
55+
static External New(napi_env env,
5656
T* data,
5757
Finalizer finalizeCallback,
5858
Hint* finalizeHint);

‎doc/threadsafe_function.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ New(napi_env env,
7070
opportunity for cleaning up after the threads e.g. by calling
7171
`uv_thread_join()`. It is important that, aside from the main loop thread,
7272
there be no threads left using the thread-safe function after the finalize
73-
callback completes. Must implement `void operator()(Env env, DataType* data,
74-
ContextType* hint)`, skipping `data` or `hint` if they are not provided. Can
75-
be retrieved via `GetContext()`.
73+
callback completes. Must implement `void operator()(Env env,
74+
FinalizerDataType* data, ContextType* context)`, skipping `data` or `context`
75+
if they are not provided. Can be retrieved via `GetContext()`.
7676
- `[optional] data`: Data to be passed to `finalizeCallback`.
7777

7878
Returns a non-empty `Napi::ThreadSafeFunction` instance.

‎doc/typed_threadsafe_function.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ New(napi_env env,
8282
calling `uv_thread_join()`. It is important that, aside from the main loop
8383
thread, there be no threads left using the thread-safe function after the
8484
finalize callback completes. Must implement `void operator()(Env env,
85-
FinalizerDataType* data, ContextType* hint)`.
85+
FinalizerDataType* data, ContextType* context)`.
8686
- `[optional] data`: Data to be passed to `finalizeCallback`.
8787
8888
Returns a non-empty `Napi::TypedThreadSafeFunction` instance.

‎napi.h‎

Lines changed: 35 additions & 3 deletions

0 commit comments

Comments
 (0)