From c8d5bab022193625cf801b62b2e68fa066acc7d5 Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Mon, 2 Jul 2018 18:20:06 -0400 Subject: [PATCH] doc: fix doc for napi_create_function Merge the two duplicate entries for `napi_create_function()`. Fixes: https://github.com/nodejs/node/issues/21606 PR-URL: https://github.com/nodejs/node/pull/21627/ Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Vse Mozhet Byt Reviewed-By: Trivikram Kamat --- doc/api/n-api.md | 44 ++++++++------------------------------------ 1 file changed, 8 insertions(+), 36 deletions(-) diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 982b15f496893b..cdb3fcaf8276bf 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -1485,40 +1485,6 @@ structure, in most cases using a `TypedArray` will suffice. For Node.js >=4 `Buffers` are `Uint8Array`s. -#### napi_create_function - -```C -napi_status napi_create_function(napi_env env, - const char* utf8name, - size_t length, - napi_callback cb, - void* data, - napi_value* result) -``` - -- `[in] env`: The environment that the API is invoked under. -- `[in] utf8name`: A string representing the name of the function encoded as -UTF8. -- `[in] length`: The length of the `utf8name` in bytes, or -`NAPI_AUTO_LENGTH` if it is null-terminated. -- `[in] cb`: A function pointer to the native function to be invoked when the -created function is invoked from JavaScript. -- `[in] data`: Optional arbitrary context data to be passed into the native -function when it is invoked. -- `[out] result`: A `napi_value` representing a JavaScript function. - -Returns `napi_ok` if the API succeeded. - -This API returns an N-API value corresponding to a JavaScript `Function` object. -It's used to wrap native functions so that they can be invoked from JavaScript. - -JavaScript `Function`s are described in -[Section 19.2](https://tc39.github.io/ecma262/#sec-function-objects) -of the ECMAScript Language Specification. - #### napi_create_object