问题
I am curious about how BreezeJS is able to determine which properties of an entity have changed and still support IE8?
I am in the need of similar functionality for a library I am building. JavaScript setters/getters would be the easiest solution however they are not support on non-dom objects in IE8.
Are they using something like : https://gist.github.com/eligrey/384583 : or something else?
回答1:
It depends on the "modelLibrary" in use, for backbone and knockout Breeze uses the "observability" of the underlying knockout or backbone objects. For something like AngularJS, where there is no requirement for an underlying object to support observability, Breeze uses its "backingStore" model library which does something very similar to the Object.watch implementation that you are pointing to in your question.
The "backingStore" implementation, like the Object.watch implementation above will NOT work on IE8 because there is no support for javascripts "defineProperty".
Hope this helps.
来源:https://stackoverflow.com/questions/16367365/how-does-breezejs-track-property-changes