Do we need `wrapper_`?

Open
#140 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, nodejs
Domain
documentation

Research direction

Start by searching the ObjectWrap N-API examples for wrapper_, napi_wrap(), and napi_delete_reference(). Confirm whether wrapper_ is unused and check how the examples build; done means removing unnecessary storage without breaking the examples or their illustration of object wrapping.

Written by the indexing model from the issue text.

Description

In our ObjectWrap N-API examples we store the napi_ref returned from napi_wrap() in the native object instance although we never use it. To napi_delete_reference() in the destructor we need to also store the napi_env on the native instance – a practice we discourage.

Do we do this for illustration purposes? Can we remove this, since wrapper_ is not being used anywhere?

Dominant language
C++
Stars
2.6k
Forks
602
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nodejs/node-addon-examples

All issues in nodejs/node-addon-examples

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.