Skip to content

Commit 58688d9

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: #19265 PR-URL: #18661 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 2838f9b commit 58688d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

doc/api/n-api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ For example, to set a function to be returned by the `require()` for the addon:
918918
napi_value Init(napi_env env, napi_value exports) {
919919
napi_value method;
920920
napi_status status;
921-
status = napi_create_function(env, "exports", Method, NULL, &method);
921+
status = napi_create_function(env, "exports", NAPI_AUTO_LENGTH, Method, NULL, &method);
922922
if (status != napi_ok) return NULL;
923923
return method;
924924
}

0 commit comments

Comments
 (0)