Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Object::New() taking a list of properties #603

Closed
dmitryash opened this issue Nov 16, 2019 · 5 comments
Closed

Add Object::New() taking a list of properties #603

dmitryash opened this issue Nov 16, 2019 · 5 comments
Assignees
Labels

Comments

@dmitryash
Copy link
Contributor

Example:

static Object New(
    napi_env env, ///< N-API environment
    const std::initializer_list<PropertyDescriptor> &properties  ///< initial prperties
);
@NickNaso
Copy link
Member

I don't know if we can do this because to create a Napi::PropertyDescriptor accessor we need the object on which the accessor will be defined. So the actual workaround is:

  • Create a Napi::Object object
  • Create Napi::PropertyDescriptor descriptors that you need
  • Use the Napi::Object::DefineProperties method that take a list of properties as parameters.

At moment I don't have a solution @gabrielschulhof do you have some idea about that?

@gabrielschulhof
Copy link
Contributor

With #610 we should be able to do it.

@NickNaso
Copy link
Member

Great I want work on this after your PR will be landed.

@NickNaso
Copy link
Member

NickNaso commented Dec 5, 2019

Ok #610 has been landed, now I can start working on this.

@github-actions
Copy link

This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants