getoutreach / epf

A framework for keeping your Ember.js apps in sync.
http://epf.io
MIT License
369 stars 33 forks source link

`diff` public API #93

Open heartsentwined opened 10 years ago

heartsentwined commented 10 years ago

Is there a public API to get the diff of a particular model instance?

I'm currently using

# foo is a model instance of App.Foo
diff = foo.diff foo.session.getShadow(foo)
propChanged = !!diff.filterBy('name', 'prop').length

Is this the canonical way of doing so in epf? I understand that it only returns a list of changed properties for now, but that's enough for my use case.

If there is no public API for now and if you like this solution, I can make a PR for it.

ghempton commented 10 years ago

There is not currently a public API. model.diff is still pretty primitive right now. Ideally I would like to pull in a 3rd party diffing library and perform the diff on a raw attribute pojo.