Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: fix some Finalizer signatures #414

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions napi.h
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,12 @@ namespace Napi {
public:
static External New(napi_env env, T* data);

// Finalizer must implement operator() accepting a T* and returning void.
// Finalizer must implement `void operator()(Env env, T* data)`.
template <typename Finalizer>
static External New(napi_env env,
T* data,
Finalizer finalizeCallback);
// Finalizer must implement operator() accepting a T* and Hint* and returning void.
// Finalizer must implement `void operator()(Env env, T* data, Hint* hint)`.
template <typename Finalizer, typename Hint>
static External New(napi_env env,
T* data,
Expand Down Expand Up @@ -686,8 +686,7 @@ namespace Napi {
size_t byteLength, ///< Length of the external buffer to be used by the array,
/// in bytes
Finalizer finalizeCallback ///< Function to be called when the array buffer is destroyed;
/// must implement `operator()`, accept a `void*` (which is the
/// data buffer pointer), and return `void`
/// must implement `void operator()(Env env, void* externalData)`
);

/// Creates a new ArrayBuffer instance, using an external buffer with specified byte length.
Expand All @@ -698,8 +697,7 @@ namespace Napi {
size_t byteLength, ///< Length of the external buffer to be used by the array,
/// in bytes
Finalizer finalizeCallback, ///< Function to be called when the array buffer is destroyed;
/// must implement `operator()`, accept a `void*` (which is the
/// data buffer pointer) and `Hint*`, and return `void`
/// must implement `void operator()(Env env, void* externalData, Hint* hint)`
Hint* finalizeHint ///< Hint (second parameter) to be passed to the finalize callback
);

Expand Down Expand Up @@ -969,12 +967,12 @@ namespace Napi {
static Buffer<T> New(napi_env env, size_t length);
static Buffer<T> New(napi_env env, T* data, size_t length);

// Finalizer must implement operator() accepting a T* and returning void.
// Finalizer must implement `void operator()(Env env, T* data)`.
template <typename Finalizer>
static Buffer<T> New(napi_env env, T* data,
size_t length,
Finalizer finalizeCallback);
// Finalizer must implement operator() accepting a T* and Hint* and returning void.
// Finalizer must implement `void operator()(Env env, T* data, Hint* hint)`.
template <typename Finalizer, typename Hint>
static Buffer<T> New(napi_env env, T* data,
size_t length,
Expand Down