Skip to content

Conversation

@sorvell
Copy link
Member

@sorvell sorvell commented Jan 17, 2019

Fixes #450. This removes all wrapping of existing accessors. This changes makes property generation simpler and more straightforward. If an accessor should not be generated, for example when there is a user defined accessor, users should set the noAccessor flag to true.

…sor`

Fixes #450. This removes all wrapping of existing accessors. This changes makes property generation simpler and more straightforward. If an accessor should not be generated, for example when there is a user defined accessor, users should set the `noAccessor` flag to true.
@sorvell sorvell added this to the 1.0.0 milestone Jan 17, 2019
Steven Orvell added 2 commits January 17, 2019 11:54
…rototype

This means `noAccessor` is only required when extending a user defined accessor with new metadata.
Copy link
Member

@kevinpschaaf kevinpschaaf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved, with some code comment suggestions.

clazz.createProperty(element.key, options);
}
};
// createProperty() takes care of defining the property, but we still
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move comment to below the else

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

enumerable : true
};
} else {
if (!options.noAccessor && !this.prototype.hasOwnProperty(name)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an early return would read nicer here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

set(value: any) {
const oldValue = this[name];
this[key] = value;
const desc = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can inline this into the defineProperty call now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Steven Orvell and others added 5 commits January 17, 2019 16:09
@sorvell sorvell merged commit c6e0581 into master Jan 18, 2019
@sorvell sorvell deleted the no-wrap-accessor branch January 18, 2019 01:07
kevinpschaaf added a commit that referenced this pull request Jan 18, 2019
Since we no longer wrap existing accessors, the language and example in #accessors-custom is updated to indicate the user must manually call `requestUpdate`.

In addition, since `noAccessor` is _only_ needed now in a pretty esoteric case (extending a superclass and changing metadata for a declared property _that also has a custom accessor_), the code example in that section is simplified.
ghost pushed a commit that referenced this pull request Feb 5, 2019
…#460)

* Update docs to reflect #454 change to remove accessor wrapping

Since we no longer wrap existing accessors, the language and example in #accessors-custom is updated to indicate the user must manually call `requestUpdate`.

In addition, since `noAccessor` is _only_ needed now in a pretty esoteric case (extending a superclass and changing metadata for a declared property _that also has a custom accessor_), the code example in that section is simplified.

* Code samples for accessors with subclassing

* Update per feedback
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 this pull request may close these issues.

4 participants