Skip to content
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

Variable name continuity #338

Closed
leoj3n opened this issue Dec 29, 2018 · 8 comments
Closed

Variable name continuity #338

leoj3n opened this issue Dec 29, 2018 · 8 comments

Comments

@leoj3n
Copy link

leoj3n commented Dec 29, 2018

It doesn't matter much, but I was wondering what is the more "correct" variable name for the second parameter of these get functions: setVal or resolve? Also, it's not clear to me the purpose of this pattern; Is the purpose simply to avoid having {{#if promise.isResolved}} checks in the stache?

get: function(lastSet, setVal){

get: function(lastSet, setVal){

get: function(lastSet, resolve){

get: function(set, resolve){

get: function(lastSet, resolve){

@justinbmeyer
Copy link
Contributor

resolve is much more accurate. Sometimes other getters might need these values. Those getters would not be able to be able to read the value in the promise synchronously (there is a way as of 4.0).

@leoj3n
Copy link
Author

leoj3n commented Dec 31, 2018

@justinbmeyer Thanks. What is the alternative way for a getter awaiting a promise as of 4.0?

@justinbmeyer
Copy link
Contributor

This same technique works in 3.0.

@leoj3n
Copy link
Author

leoj3n commented Jan 1, 2019

@justinbmeyer Your comment wasn't a response to me was it?

@justinbmeyer
Copy link
Contributor

It was. What are you looking for? Async getters go back a long way.

@leoj3n
Copy link
Author

leoj3n commented Jan 1, 2019

Sorry, I think I probably have misunderstood you.

In your first comment, all this is clear:

resolve is much more accurate. Sometimes other getters might need these values. Those getters would not be able to be able to read the value in the promise synchronously

However, the meaning of this bit in parenthesis was not clear to me:

(there is a way as of 4.0).

I assumed you meant that in 4.0, there exists a new or alternative pattern for a getter awaiting another getter's promise (other than the one discussed in the OP). That's why I followed up with:

What is the alternative way for a getter awaiting a promise as of 4.0?

You let me know the pattern in the OP works in 3.0 as well, but it still is not clear to me what was meant by "there is a way as of 4.0" in regards to being able to read the value in the promise synchronously.

So, it's not clear to me what you were hinting at when you said:

(there is a way as of 4.0).

And that's what I was expecting a reply about!

So, what was meant by "there is a way as of 4.0"?

Anyways, hopefully my misunderstanding here makes sense and you can help clear it up! Thanks.

@justinbmeyer
Copy link
Contributor

In 4.0 you could write:

get(){ return canReflect.getKeyValue(this.promise,”value”) }

@leoj3n
Copy link
Author

leoj3n commented Jan 4, 2019

That is pretty cool. Thanks

@leoj3n leoj3n closed this as completed Jan 4, 2019
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

No branches or pull requests

2 participants