Closed kevincolten closed 8 years ago
This is a very specific use case and goes far beyond the scope of the library itself. Making disparate bits of software place nice is difficult, and I wish you luck! My best advice would be to think about application design where the bits are NOT mixed. Epoxy is best used for display concerns. If you have heavy data concerns, perhaps do that as a separate layer of your application, and then build a display layer infront of it.
Using a mixin library such as Backbone.Cocktail to maintain functionality for two disparate libraries, for instance Backbone.Epoxy.Model and Backbone.RelationalModel, you get the benefit of utilizing the important functions in both, like
get()
andset()
, without overriding. Here is an example of mixing them in, copy/pasted from https://github.com/gmac/backbone.epoxy/issues/108:and your destroy method, afterwards, would function like this:
note: Cocktail does something a little more complicated, this just illustrates the functionality
The issue here is that the model's
destroy()
call will be called twice. Is there a better method anyone can think of to better utilize the mixin functionality of Epoxy.Model?My current solution was to just comment out a few extra calls to
_super
:though I haven't extensively tested the downstream effects.