Skip to content

Commit fa49d68

Browse files
DaAitchmhdawson
authored andcommitted
doc: fix some Finalizer signatures
- External::New - ArrayBuffer::New - Buffer::New PR-URL: #414 Fixes: #383 Refs: #384 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent 020ac4a commit fa49d68

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

napi.h

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -633,12 +633,12 @@ namespace Napi {
633633
public:
634634
static External New(napi_env env, T* data);
635635

636-
// Finalizer must implement operator() accepting a T* and returning void.
636+
// Finalizer must implement `void operator()(Env env, T* data)`.
637637
template <typename Finalizer>
638638
static External New(napi_env env,
639639
T* data,
640640
Finalizer finalizeCallback);
641-
// Finalizer must implement operator() accepting a T* and Hint* and returning void.
641+
// Finalizer must implement `void operator()(Env env, T* data, Hint* hint)`.
642642
template <typename Finalizer, typename Hint>
643643
static External New(napi_env env,
644644
T* data,
@@ -686,8 +686,7 @@ namespace Napi {
686686
size_t byteLength, ///< Length of the external buffer to be used by the array,
687687
/// in bytes
688688
Finalizer finalizeCallback ///< Function to be called when the array buffer is destroyed;
689-
/// must implement `operator()`, accept a `void*` (which is the
690-
/// data buffer pointer), and return `void`
689+
/// must implement `void operator()(Env env, void* externalData)`
691690
);
692691

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

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

972-
// Finalizer must implement operator() accepting a T* and returning void.
970+
// Finalizer must implement `void operator()(Env env, T* data)`.
973971
template <typename Finalizer>
974972
static Buffer<T> New(napi_env env, T* data,
975973
size_t length,
976974
Finalizer finalizeCallback);
977-
// Finalizer must implement operator() accepting a T* and Hint* and returning void.
975+
// Finalizer must implement `void operator()(Env env, T* data, Hint* hint)`.
978976
template <typename Finalizer, typename Hint>
979977
static Buffer<T> New(napi_env env, T* data,
980978
size_t length,

0 commit comments

Comments
 (0)