From a8f63809e0cc7ded1dd141fb9c74b270eca79dfd Mon Sep 17 00:00:00 2001 From: Kevin Eady <8634912+KevinEady@users.noreply.github.com> Date: Thu, 25 Jul 2024 16:23:43 +0200 Subject: [PATCH] fix docs --- doc/array_buffer.md | 6 +++--- doc/basic_env.md | 8 ++++---- doc/buffer.md | 10 +++++----- doc/env.md | 4 +++- doc/external.md | 6 +++--- doc/object_wrap.md | 2 +- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/doc/array_buffer.md b/doc/array_buffer.md index 9bb925129..de05e55b3 100644 --- a/doc/array_buffer.md +++ b/doc/array_buffer.md @@ -37,7 +37,7 @@ method will not provide the caller with an opportunity to free the data when the retained by the `Napi::ArrayBuffer` object please use other variants of the `Napi::ArrayBuffer::New` factory method that accept `Napi::Finalizer`, which is a function that will be invoked when the `Napi::ArrayBuffer` object has been -destroyed. See [Finalization]() for more details. +destroyed. See [Finalization][] for more details. ```cpp static Napi::ArrayBuffer Napi::ArrayBuffer::New(napi_env env, void* externalData, size_t byteLength); @@ -74,7 +74,7 @@ static Napi::ArrayBuffer Napi::ArrayBuffer::New(napi_env env, - `[in] byteLength`: The length of the `externalData`, in bytes. - `[in] finalizeCallback`: A function called when the engine destroys the `Napi::ArrayBuffer` object, implementing `operator()(Napi::BasicEnv, void*)`. - See [Finalization]() for more details. + See [Finalization][] for more details. Returns a new `Napi::ArrayBuffer` instance. @@ -104,7 +104,7 @@ static Napi::ArrayBuffer Napi::ArrayBuffer::New(napi_env env, - `[in] byteLength`: The length of the `externalData`, in bytes. - `[in] finalizeCallback`: A function called when the engine destroys the `Napi::ArrayBuffer` object, implementing `operator()(Napi::BasicEnv, void*, - Hint*)`. See [Finalization]() for more details. + Hint*)`. See [Finalization][] for more details. - `[in] finalizeHint`: The hint value passed to the `finalizeCallback` function. Returns a new `Napi::ArrayBuffer` instance. diff --git a/doc/basic_env.md b/doc/basic_env.md index e8af172bb..5ef619d5d 100644 --- a/doc/basic_env.md +++ b/doc/basic_env.md @@ -8,7 +8,7 @@ or node-addon-api infrastructure. The `Napi::BasicEnv` object represents an environment that has a limited subset of APIs when compared to `Napi::Env` and can be used in basic finalizers. See -[Finalization]() for more details. +[Finalization][] for more details. ## Methods @@ -122,7 +122,7 @@ inline void PostFinalizer(FinalizerType finalizeCallback) const; ``` - `[in] finalizeCallback`: The function to queue for execution outside of the GC - finalization, implementing `operator()(Napi::Env)`. See [Finalization]() for + finalization, implementing `operator()(Napi::Env)`. See [Finalization][] for more details. ### PostFinalizer @@ -133,7 +133,7 @@ inline void PostFinalizer(FinalizerType finalizeCallback, T* data) const; ``` - `[in] finalizeCallback`: The function to queue for execution outside of the GC - finalization, implementing `operator()(Napi::Env, T*)`. See [Finalization]() + finalization, implementing `operator()(Napi::Env, T*)`. See [Finalization][] for more details. - `[in] data`: The data to associate with the object. @@ -148,7 +148,7 @@ inline void PostFinalizer(FinalizerType finalizeCallback, - `[in] finalizeCallback`: The function to queue for execution outside of the GC finalization, implementing `operator()(Napi::Env, T*, Hint*)`. See - [Finalization]() for more details. + [Finalization][] for more details. - `[in] data`: The data to associate with the object. - `[in] finalizeHint`: The hint value passed to the `finalizeCallback` function. diff --git a/doc/buffer.md b/doc/buffer.md index 2e2ac87de..548400481 100644 --- a/doc/buffer.md +++ b/doc/buffer.md @@ -35,7 +35,7 @@ with an opportunity to free the data when the `Napi::Buffer` gets garbage-collected. If you need to free the data retained by the `Napi::Buffer` object please use other variants of the `Napi::Buffer::New` factory method that accept `Finalizer`, which is a function that will be invoked when the -`Napi::Buffer` object has been destroyed. See [Finalization]() for more details. +`Napi::Buffer` object has been destroyed. See [Finalization][] for more details. ```cpp static Napi::Buffer Napi::Buffer::New(napi_env env, T* data, size_t length); @@ -71,7 +71,7 @@ static Napi::Buffer Napi::Buffer::New(napi_env env, - `[in] length`: The number of `T` elements in the external data. - `[in] finalizeCallback`: The function called when the engine destroys the `Napi::Buffer` object, implementing `operator()(Napi::BasicEnv, T*)`. See - [Finalization]() for more details. + [Finalization][] for more details. Returns a new `Napi::Buffer` object. @@ -100,7 +100,7 @@ static Napi::Buffer Napi::Buffer::New(napi_env env, - `[in] length`: The number of `T` elements in the external data. - `[in] finalizeCallback`: The function called when the engine destroys the `Napi::Buffer` object, implementing `operator()(Napi::BasicEnv, T*, Hint*)`. - See [Finalization]() for more details. + See [Finalization][] for more details. - `[in] finalizeHint`: The hint value passed to the `finalizeCallback` function. Returns a new `Napi::Buffer` object. @@ -157,7 +157,7 @@ static Napi::Buffer Napi::Buffer::NewOrCopy(napi_env env, - `[in] length`: The number of `T` elements in the external data. - `[in] finalizeCallback`: The function called when the engine destroys the `Napi::Buffer` object, implementing `operator()(Napi::BasicEnv, T*)`. See - [Finalization]() for more details. + [Finalization][] for more details. Returns a new `Napi::Buffer` object. @@ -186,7 +186,7 @@ static Napi::Buffer Napi::Buffer::NewOrCopy(napi_env env, - `[in] length`: The number of `T` elements in the external data. - `[in] finalizeCallback`: The function called when the engine destroys the `Napi::Buffer` object, implementing `operator()(Napi::BasicEnv, T*, Hint*)`. - See [Finalization]() for more details. + See [Finalization][] for more details. - `[in] finalizeHint`: The hint value passed to the `finalizeCallback` function. Returns a new `Napi::Buffer` object. diff --git a/doc/env.md b/doc/env.md index 1989ea4e2..e50331496 100644 --- a/doc/env.md +++ b/doc/env.md @@ -7,7 +7,8 @@ The `Napi::Env` object is usually created and passed by the Node.js runtime or node-addon-api infrastructure. The `Napi::Env` object represents an environment that has a superset of APIs -when compared to `Napi::BasicEnv` and therefore _cannot_ be used in basic finalizers. +when compared to `Napi::BasicEnv` and therefore _cannot_ be used in basic +finalizers. See [Finalization][] for more details. ## Methods @@ -81,3 +82,4 @@ The `script` can be any of the following types: - `const char *` - `const std::string &` +[Finalization]: ./finalization.md diff --git a/doc/external.md b/doc/external.md index 962da722f..4b4603e8e 100644 --- a/doc/external.md +++ b/doc/external.md @@ -8,7 +8,7 @@ The `Napi::External` template class implements the ability to create a `Napi::Va optional Hint value. The `Finalizer` function, if specified, is called when your `Napi::External` object is released by Node's garbage collector. It gives your code the opportunity to free any dynamically created data. If you specify a Hint -value, it is passed to your `Finalizer` function. See [Finalization]() for more details. +value, it is passed to your `Finalizer` function. See [Finalization][] for more details. Note that `Napi::Value::IsExternal()` will return `true` for any external value. It does not differentiate between the templated parameter `T` in @@ -44,7 +44,7 @@ static Napi::External Napi::External::New(napi_env env, - `[in] data`: The arbitrary C++ data to be held by the `Napi::External` object. - `[in] finalizeCallback`: The function called when the engine destroys the `Napi::External` object, implementing `operator()(Napi::BasicEnv, T*)`. See - [Finalization]() for more details. + [Finalization][] for more details. Returns the created `Napi::External` object. @@ -62,7 +62,7 @@ static Napi::External Napi::External::New(napi_env env, - `[in] data`: The arbitrary C++ data to be held by the `Napi::External` object. - `[in] finalizeCallback`: The function called when the engine destroys the `Napi::External` object, implementing `operator()(Napi::BasicEnv, T*, Hint*)`. - See [Finalization]() for more details. + See [Finalization][] for more details. - `[in] finalizeHint`: The hint value passed to the `finalizeCallback` function. Returns the created `Napi::External` object. diff --git a/doc/object_wrap.md b/doc/object_wrap.md index 29e1eee48..40fb3bf12 100644 --- a/doc/object_wrap.md +++ b/doc/object_wrap.md @@ -242,7 +242,7 @@ request being made. ### Finalize Provides an opportunity to run cleanup code that only utilizes basic Node APIs, if any. -Override to implement. See [Finalization]() for more details. +Override to implement. See [Finalization][] for more details. ```cpp virtual void Finalize(Napi::BasicEnv env);