Skip to content

InstanceMember creates read only, not enumerable and not configurable properties on default #811

Description

@Flarna

InstanceMember uses napi_default for attributes if nothing else is specified.

napi_default means read only, not enumerable and not configurable.

The corresponding NAN API SetPrototypeMethod calls PrototypeTemplate()->Set() and to my understanding of the v8 API they use PropertyAttribute::None which is defined inverted:

enum PropertyAttribute {
  /** None. **/
  None = 0,
  /** ReadOnly, i.e., not writable. **/
  ReadOnly = 1 << 0,
  /** DontEnum, i.e., not enumerable. **/
  DontEnum = 1 << 1,
  /** DontDelete, i.e., not configurable. **/
  DontDelete = 1 << 2
};

Is this difference intended? In general non configurable properties are quite uncommon in JS world.

FWIW: If I define a class in javascript members are configureable, writable and not enumerable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions