[FEAT] Updates @tracked to match the Tracked Properties RFC#17572
Merged
krisselden merged 4 commits intoemberjs:masterfrom Feb 9, 2019
Merged
[FEAT] Updates @tracked to match the Tracked Properties RFC#17572krisselden merged 4 commits intoemberjs:masterfrom
krisselden merged 4 commits intoemberjs:masterfrom
Conversation
93b8039 to
c2afda0
Compare
c3e98c2 to
99cb377
Compare
Member
|
@pzuraq - Can you fix the package.json conflict here? |
Updates @Tracked to be a classic decorator as well as a standard native decorator, removes the ability to decorator native getters, and adds more tests for various situations and updates the existing tests. This PR also exposes the native `descriptor` decorator for use defining getters and setters: ```js import EmberObject, { descriptor } from '@ember/object'; import { tracked } from '@glimmer/tracking'; const Person = EmberObject.extend({ firstName: tracked({ value: 'Tom' }), lastName: tracked({ value: 'Dale' }), fullName: descriptor({ get() { return `${this.firstName} ${this.lastName}`; }, }), }); ```
99cb377 to
0070773
Compare
rwjblue
reviewed
Feb 8, 2019
| import { setComputedDecorator } from './lib/decorator'; | ||
| import { tracked } from './lib/tracked'; | ||
|
|
||
| // We have to set this here because there is a cycle of dependencies in tracked |
Member
There was a problem hiding this comment.
We should work to remove this cycle before landing
rwjblue
approved these changes
Feb 9, 2019
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.
Updates
@trackedto be a classic decorator as well as a standardnative decorator, removes the ability to decorator native getters, and
adds more tests for various situations and updates the existing tests.
One thing to note is that users can still provide getters/setters to
classic classes via tracked:
The reasoning behind this is there is no way to do this currently, and
it allows us to match behavior between native/classic exactly.
Alternatively we could expose the native descriptor decorator that is
internal only right now, but unfortunately
computedwill not be ableto fill this role since it requires use of
Ember.set, where nativegetters/setters do not.
TODO: