mardi 23 juin 2015

How to get notified on model changes in generic way with ember data

I am using Ember and Ember Data and I would like to listen to any changes relevant for a specific model. For example in my app I could have an Order model with two fields - 'attr1' and 'attr2'.
The two use cases/questions are:
1) How to get notified when new Order instances get added or deleted to/from store. Something like store.on(modelName, 'deleted/added', listener). modelName in this case would equal 'order'.
2) How to get notified on any change within all models of specific type in the store. Something like store.on(modelName, 'modelUpdated', listener). I don't want to specify in which attributes I am interested because I am interested in any change in any attribute.

Any ideas and pointers are really appreciated.




Aucun commentaire:

Enregistrer un commentaire