Is it a good idea to pass a model or a collection data in a message on every event. E.g.
messageBus.on('someEvent',modelData);
and the subscriber than receives the data.
Or it is better to have kind of service (JS module) which would store and update the data on a model/collection throughout the app lifecycle and there should be an event 'data:changed' raised on every occasion, when this.dataa is updated.
The subscriber would then look up the changes in a service this.data on every 'data:changed'
The first approach seems to be convenient since there is no need to create a service in addition to a model (BackboneJS) when I do not really need a service. But is there any disadvantages in sending data on every event? E.g. memory consumptions, etc.
Aucun commentaire:
Enregistrer un commentaire