From fa49d6841616c12d2602a5454599fc6e8783d0cc Mon Sep 17 00:00:00 2001 From: Philipp Renoth Date: Wed, 26 Dec 2018 15:51:27 +0100 Subject: [PATCH] doc: fix some `Finalizer` signatures - External::New - ArrayBuffer::New - Buffer::New PR-URL: https://github.com/nodejs/node-addon-api/pull/414 Fixes: https://github.com/nodejs/node-addon-api/issues/383 Refs: https://github.com/nodejs/node-addon-api/pull/384 Reviewed-By: Michael Dawson --- napi.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/napi.h b/napi.h index 22fbd2de9..bff387adb 100644 --- a/napi.h +++ b/napi.h @@ -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 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 static External New(napi_env env, T* data, @@ -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. @@ -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 ); @@ -969,12 +967,12 @@ namespace Napi { static Buffer New(napi_env env, size_t length); static Buffer 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 static Buffer 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 static Buffer New(napi_env env, T* data, size_t length,