doc: update ObjectWrap example#754
Closed
gabrielschulhof wants to merge 1 commit intonodejs:masterfrom
Closed
Conversation
addaleax
approved these changes
Jun 29, 2020
28e53d1 to
6252e48
Compare
NickNaso
reviewed
Jun 30, 2020
Member
NickNaso
left a comment
There was a problem hiding this comment.
Just one thing to do. The rest seems good.
doc/object_wrap.md
Outdated
| // Retrieve the instance data we stored during `Init()`. We only stored the | ||
| // constructor there, so we retrieve it here to create a new instance of the | ||
| // JS class the constructor represents. | ||
| Napi::FunctionReference* constructor = info.Env().GetInstanceData<Example>(); |
Member
There was a problem hiding this comment.
It should be:
Napi::FunctionReference* constructor = info.Env().GetInstanceData<Napi::FunctionReference>();
Contributor
Author
There was a problem hiding this comment.
You're right! Good catch! Thanks!
* Remove the global static reference to the constructor * Use `Napi::Env::SetInstanceData` to store the constructor, and * Add a static method that uses `Napi::FunctionReference::New` to create a new instance of the class by retrieving the constructor using `Napi::Env::GetInstanceData` and using `Napi::FunctionReference::New` to create the new instance. Fixes: nodejs#711
6252e48 to
e095c01
Compare
gabrielschulhof
pushed a commit
that referenced
this pull request
Jul 2, 2020
* Remove the global static reference to the constructor * Use `Napi::Env::SetInstanceData` to store the constructor, and * Add a static method that uses `Napi::FunctionReference::New` to create a new instance of the class by retrieving the constructor using `Napi::Env::GetInstanceData` and using `Napi::FunctionReference::New` to create the new instance. Fixes: #711 PR-URL: #754 Reviewed-By: Nicola Del Gobbo <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Contributor
Author
|
Landed in ef16dfb. |
artemp
added a commit
to mapnik/node-mapnik
that referenced
this pull request
Aug 14, 2020
kevindavies8
added a commit
to kevindavies8/node-addon-api-Develop
that referenced
this pull request
Aug 24, 2022
* Remove the global static reference to the constructor * Use `Napi::Env::SetInstanceData` to store the constructor, and * Add a static method that uses `Napi::FunctionReference::New` to create a new instance of the class by retrieving the constructor using `Napi::Env::GetInstanceData` and using `Napi::FunctionReference::New` to create the new instance. Fixes: nodejs/node-addon-api#711 PR-URL: nodejs/node-addon-api#754 Reviewed-By: Nicola Del Gobbo <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Marlyfleitas
added a commit
to Marlyfleitas/node-api-addon-Development
that referenced
this pull request
Aug 26, 2022
* Remove the global static reference to the constructor * Use `Napi::Env::SetInstanceData` to store the constructor, and * Add a static method that uses `Napi::FunctionReference::New` to create a new instance of the class by retrieving the constructor using `Napi::Env::GetInstanceData` and using `Napi::FunctionReference::New` to create the new instance. Fixes: nodejs/node-addon-api#711 PR-URL: nodejs/node-addon-api#754 Reviewed-By: Nicola Del Gobbo <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
wroy7860
added a commit
to wroy7860/addon-api-benchmark-node
that referenced
this pull request
Sep 19, 2022
* Remove the global static reference to the constructor * Use `Napi::Env::SetInstanceData` to store the constructor, and * Add a static method that uses `Napi::FunctionReference::New` to create a new instance of the class by retrieving the constructor using `Napi::Env::GetInstanceData` and using `Napi::FunctionReference::New` to create the new instance. Fixes: nodejs/node-addon-api#711 PR-URL: nodejs/node-addon-api#754 Reviewed-By: Nicola Del Gobbo <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
johnfrench3
pushed a commit
to johnfrench3/node-addon-api-git
that referenced
this pull request
Aug 11, 2023
* Remove the global static reference to the constructor * Use `Napi::Env::SetInstanceData` to store the constructor, and * Add a static method that uses `Napi::FunctionReference::New` to create a new instance of the class by retrieving the constructor using `Napi::Env::GetInstanceData` and using `Napi::FunctionReference::New` to create the new instance. Fixes: nodejs/node-addon-api#711 PR-URL: nodejs/node-addon-api#754 Reviewed-By: Nicola Del Gobbo <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Napi::Env::SetInstanceDatato store the constructor, andNapi::FunctionReference::Newtocreate a new instance of the class by retrieving the constructor
using
Napi::Env::GetInstanceDataand usingNapi::FunctionReference::Newto create the new instance.Fixes: #711