[Question] Why are the return values of the two functions different?
sdg9670 opened this issue · 1 comments
sdg9670 commented
I'm Newby, who just got into NAPI.
In the above two codes, methods are create and return the object.
I wonder why only the return value in NewInstance
uses escape scope.
mhdawson commented
The different is that in the first case the creation of the object was done in the context of a scope
Napi::EscapableHandleScope scope(env);
You can read more about scopes in -> https://github.com/nodejs/node-addon-api/blob/main/doc/handle_scope.md#handlescope