You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Observers and computed properties currently require string values. This hides them from most static analysis engines and refactoring tools. They are also difficult to use with Closure-compiler's advanced mode as properties get renamed.
Need to provide an alternative way to use these property effects that does not depend on strings.
Simple Observers
This is the easiest fix. Allow a function to be specified directly instead of just a string.
These are grouped together because they suffer from the same problem: change notification. A computed property is best defined as an ES6 getter and a complex observer is already an instance method. The only thing needed is change notifications from properties that these methods depend on. This isn't hard to wire up manually with a simple observer and calls to notifyPath, but it could be a bit easier.
Is there perhaps a way to express the dependency in reverse?
#4815 allows ES6 getters to be used instead of computed properties. I'm going to run some tests and make sure, but I think that linkPaths should provide a way to indicate that changes on one path should recalculate the getter value. This solves the computed properties use case.
For complex observers, there is no obvious solution. However perhaps it is acceptable to leave these as-is so as to discourage their use.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed after being marked stale. If you're still facing this problem with the above solution, please comment and we'll reopen!
Observers and computed properties currently require string values. This hides them from most static analysis engines and refactoring tools. They are also difficult to use with Closure-compiler's advanced mode as properties get renamed.
Need to provide an alternative way to use these property effects that does not depend on strings.
Simple Observers
This is the easiest fix. Allow a function to be specified directly instead of just a string.
Complex Observers and Computed Properties
These are grouped together because they suffer from the same problem: change notification. A computed property is best defined as an ES6 getter and a complex observer is already an instance method. The only thing needed is change notifications from properties that these methods depend on. This isn't hard to wire up manually with a simple observer and calls to
notifyPath
, but it could be a bit easier.Is there perhaps a way to express the dependency in reverse?
The text was updated successfully, but these errors were encountered: