-
-
Notifications
You must be signed in to change notification settings - Fork 497
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
upd(configure:ember): add writeup on default-async-observers #1215
Conversation
045e805
to
8e0c5bb
Compare
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.
Person.reopen({ | ||
partOfNameChanged: observer({ | ||
dependentKeys: ['firstName', 'lastName'], | ||
function() { |
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.
Is the code example correct here, or should it rather be
function() { | |
fn() { |
I couldn't find any documentation on it (which seems to be the reason for this PR 😅 )
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.
It is indeed supposed to be named fn
Also, the RFC has a bit of detail on the exact signature too https://github.com/emberjs/rfcs/blob/master/text/0494-async-observers.md
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.
Super, thank you for the reference 🙇♀
``` | ||
|
||
While the `default-async-observers` feature is only enabled by default in modern Ember applications, | ||
you can enable this optional feature in older apps (Ember 3.13+) as follows: |
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.
Let me know if you find it more useful to just skip this part of the phrase referring to the old behaviour. If we skip this part, we could also just show how to disable the feature in current Ember apps in the code example below
Person.reopen({ | ||
partOfNameChanged: observer({ | ||
dependentKeys: ['firstName', 'lastName'], | ||
function() { |
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.
It is indeed supposed to be named fn
Also, the RFC has a bit of detail on the exact signature too https://github.com/emberjs/rfcs/blob/master/text/0494-async-observers.md
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
Co-Authored-By: Robert Jackson <me@rwjblue.com>
|
||
With this feature *enabled*, Ember will run all observers in the application | ||
asynchronously by default. This leads to observers running in the runloop | ||
after the one in which the properties it observers were updated. |
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.
after the one in which the properties it observers were updated. | |
_after_ the one in which the observed properties were updated. |
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.
Not sure, why I'm not able to apply this suggestion anymore, but I added it now in a separate commit - thank you for the update 🙇♀
Co-Authored-By: Jen Weber <weberj10@gmail.com>
Co-Authored-By: Jen Weber <weberj10@gmail.com>
Co-Authored-By: Jen Weber <weberj10@gmail.com>
This should add a section documenting the use of the default async observer optional feature as described in RFC#494: emberjs/rfcs#494