-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
UI: Computed Utils #5079
Merged
Merged
UI: Computed Utils #5079
Conversation
This file contains 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
1. The factory is taken from the ember source, but makes it more reusable 2. Purify converts conventional ember `computed` into a pure version
Just had a thought this morning, the purify thing enables using default arguments which might be nice at some point? property: computed(
'items',
function(possiblyEmpty = []) {
return possiblyEmpty;
}
) |
hanshasselberg
approved these changes
Jan 25, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
johncowen
added a commit
that referenced
this pull request
Jan 28, 2019
1. The factory is taken from the ember source, but makes it more reusable 2. Purify converts conventional ember `computed` into a pure version This commit only adds new files that could be used further down the line
Merged
johncowen
added a commit
that referenced
this pull request
Feb 21, 2019
1. The factory is taken from the ember source, but makes it more reusable 2. Purify converts conventional ember `computed` into a pure version This commit only adds new files that could be used further down the line
johncowen
added a commit
that referenced
this pull request
Apr 29, 2019
1. The factory is taken from the ember source, but makes it more reusable 2. Purify converts conventional ember `computed` into a pure version This commit only adds new files that could be used further down the line
johncowen
added a commit
that referenced
this pull request
May 1, 2019
1. The factory is taken from the ember source, but makes it more reusable 2. Purify converts conventional ember `computed` into a pure version This commit only adds new files that could be used further down the line
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.
This PR includes 2
computed
utils, 1 is taken pretty much for the ember source (details in the documentation comments), for the other I'll quote Tom Dale in a recent RFC which he describes what this PR goes some way to solve as 'Dependency Hell'Tom proposes the use of decorators to solve this entirely (with caveats), which might be coming at some point soon, in the meantime at least the below is something I find helpful.
The
purify
function here essentially let's you write:This does/doesn't let you do certain things:
something
propertyanything
in my function, I just rename the argument here)get
and keep your computed function pure, it goes some way to stop the 'dependency hell'.There are no tests to accompany this yet at least:
factory
function is taken straight from the ember source, and is one of those things that is hardly worth testing.purify
function and I could do at this stage if anyone feels strongly that I should at this stage. Again its one of those functions that is hardly worth testing, but more so than thefactory
function. See the comments regarding support deeper properties, if I was to implement that I would probably accompany that with some tests as they then would be more worthwhile.