Skip to content

Commit

Permalink
doc: fix some Finalizer signatures
Browse files Browse the repository at this point in the history
- External::New
- ArrayBuffer::New
- Buffer::New

Ref: nodejs#384
Fixes: nodejs#383
  • Loading branch information
DaAitch committed Dec 26, 2018
1 parent d8e9c22 commit a69986d
Showing 1 changed file with 6 additions and 8 deletions.
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

0 comments on commit a69986d

Please sign in to comment.