-
Notifications
You must be signed in to change notification settings - Fork 66
Add a ...$updating property for each computed property. #29
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
Add a ...$updating property for each computed property. #29
Conversation
Sorry, it took me a while to get to this. I like this PR, and I'd be happy to merge it. The one thing I'll quibble about is putting the In my opinion it would be better to define a separate namespace for these properties, let's say perhaps Then the new properties would be of the form What do you think about this change? Also, let's make sure that this feature is properly documented in the README. If you'd like to add a section about it to the README that would be great, or I could write something up if you'd rather. |
Thanks for the reply Putting everything in a separate namespace seems like a good idea, I'll look into it. I can add a short example to the readme. |
@michaelzangl Any movement on this? I've been hacking together a loading indicator for If you haven't the time, I'd be happy to run with this and fulfill @foxbenjaminfox's proposal. |
@gavinhungry
The idea is to be able to pass that object to a status component and that component will display the loading indicator or error message depending on the state. |
@michaelzangl - awesome, please @ me on that when you get to it! |
you do not need any hack, just wrap the async computed by wrapper. example: function withIndicator(indicatorKey, asyncFunc) {
return async function () {
this[indicatorKey] = true
try {
return await asyncFunc.apply(this)
} catch (err) {
throw err
} finally {
this[indicatorKey] = false
}
}
} |
This won't handle race conditions correctly |
Closed in favor of #45 |
This adds a property that is true while the real property is recomputing. Can be used as a visual loading indicator: