Skip to content

Commit e9e5d56

Browse files
Aonghus O NiaMylesBorins
Aonghus O Nia
authored andcommitted
doc: fix exporting a function example
Missing the length argument in napi_create_function. Backport-PR-URL: #19447 PR-URL: #18661 Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent c90b77e commit e9e5d56

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doc/api/n-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ For example, to set a function to be returned by the `require()` for the addon:
916916
napi_value Init(napi_env env, napi_value exports) {
917917
napi_value method;
918918
napi_status status;
919-
status = napi_create_function(env, "exports", Method, NULL, &method);
919+
status = napi_create_function(env, "exports", NAPI_AUTO_LENGTH, Method, NULL, &method);
920920
if (status != napi_ok) return NULL;
921921
return method;
922922
}

0 commit comments

Comments
 (0)