Some data are injected by some external program before the app load in window.map
I have a mapManager module which has a bunch of methods to get some data from window.map ( for example , mapManager.getDestinationById() );
What I've done is that I've writtent models to get the data:
define('getDestinationByIdModel', ['backbone','mapManager'], function(Backbone, MapManager) {
var GetDestinationByIdModel = Backbone.Model.extend({
fetch: function(id) {
this.set({destination: MapManager.getDestinationById(id);
}
});
return GetDestinationByIdModel;
}
The idea was to keep the principle that to access data in a view you have to use a model.
However I'm wonderng if it's not just too heavy, why not just use the mapManager methods inside the views to access data instead of creating a model for each method of the mapManager ? Isn't a mistake to follow the model way or is it the best to do to keep some kind of fixed structure.
Thanks for sharing your thoughts