Open sebamarynissen opened 6 years ago
Is there a reason you didn't simply use so-called "raw values"?
@disruptek The reason is that I have a lot of computed properties, so I would like to "group" them within separate models where the models containing the "raw values" serve as dependencies, rather than the "raw values" itself.
I understand the schema; I just would have hacked it together more explicitly using the mechanics we already have. That said, this seems like a pretty harmless change that opens up potential for this and other (magical) use cases. :+1:
When a model has computed properties, it's only possible to specify dependencies that are attributes to that model. However, I have a case where it would be useful to do something like this:
It can be more or less compared to the concept of binding sources with Views.
I don't think that this should be integrated into Epoxy itself, but I found out that it's easy to implement this myself if the modelMap that Epoxy uses to define dependencies for computed properties was exposed. Right now this is a private variable in the Epoxy library which can't be accessed from outside the library. If it was possible to access it - for example as Epoxy.modelMap - I could implement the functionality described above by overriding the get method as
I fully understand why in principle the modelMap should be a private variable - you don't want other people to mess with how the library works internally - but I think that it can be useful to have the opportunity to access it if one wants to extend Epoxy.