Skip to content

[FEAT] Implements Decorators#17548

Merged
rwjblue merged 4 commits intoemberjs:masterfrom
pzuraq:implement-decorators
Feb 8, 2019
Merged

[FEAT] Implements Decorators#17548
rwjblue merged 4 commits intoemberjs:masterfrom
pzuraq:implement-decorators

Conversation

@pzuraq
Copy link
Contributor

@pzuraq pzuraq commented Feb 2, 2019

This is a continuation of #17226, thanks a ton to @NullVoxPopuli for getting this started!

This PR refactors the Descriptor system in Ember metal, mostly replacing
it with a Decorator system instead. defineProperty has been updated to
apply decorators following the currently implemented spec. This means
that the value returned by computed goes through the exact same flow
when applied as a decorator using decorator syntax, and applied using
classic syntax.

I was considering pulling out the ComputedDecorator stuff into a separate
package, it's relatively isolated from the rest of metal at this point
so it would make some sense. Thoughts?

TODO:

  • Benchmark
  • Disable native application except behind a canary feature flag

@pzuraq pzuraq force-pushed the implement-decorators branch 2 times, most recently from a49dbb5 to 443e536 Compare February 2, 2019 03:28
@pzuraq
Copy link
Contributor Author

pzuraq commented Feb 4, 2019

Thanks @richard-viney!

@pzuraq pzuraq force-pushed the implement-decorators branch 5 times, most recently from 0cebdcb to 4359400 Compare February 5, 2019 03:15
@pzuraq
Copy link
Contributor Author

pzuraq commented Feb 5, 2019

Benchmarked, no statistically significant change in performance when used in classic class syntax! I think this is ready for review 🎉

results.json.txt
results.pdf

@type DOMElement
@public
*/
element: descriptor({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Followup: We should flatten this class into Component so we don't need to use this decorator

@pzuraq pzuraq force-pushed the implement-decorators branch 5 times, most recently from 93d42b1 to d3a6a24 Compare February 8, 2019 19:47
NullVoxPopuli and others added 2 commits February 8, 2019 13:05
This PR refactors the Descriptor system in Ember metal, mostly replacing
it with a Decorator system instead. `defineProperty` has been updated to
apply decorators following the currently implemented spec. This means
that the value returned by `computed` goes through the exact same flow
when applied as a decorator using decorator syntax, and applied using
classic syntax.
@pzuraq pzuraq force-pushed the implement-decorators branch from d3a6a24 to 53b84e2 Compare February 8, 2019 21:05
@rwjblue rwjblue merged commit 528434e into emberjs:master Feb 8, 2019
_dependentKeys: string[] | undefined;

constructor(config: ComputedPropertyConfig, opts?: ComputedPropertyOptions) {
constructor(args: Array<string | ComputedPropertyConfig>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this change intentional? Shouldn't it be ...args instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Confirmed on Discord that it is intentional.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants