I have several views which rendering result depends on the same collection and then other models or collections:
Examaples:
View1 -> model1, commonCollection
View2 -> collection2, commonCollection
View3 -> model3, commonCollection
Right now, to solve the problem I make commonCollection.fetch for each view… and before to render the page I wait that each model/collection is ready for each view
as explained in this answer.
But since the result of commonCollection is the same, I would like to cache the result for using it for other views.
How can I cache the result of commonCollection without using global variables? I am using RequireJs
can’t you just override
fetchin common collection to do the caching?Here is a fiddle of a more complete example:
http://jsfiddle.net/4A8Wu/2/