问题
Following this post : Ember-data resets queryParam to default value,
I got another question. Can I retrieve the place where a property/queryParam changes with some kind of wizardry? I set up an observer, it effectively changes but I want to know where it is triggered. Any suggestions?
回答1:
Write the observer like this to print out the stack on the console:
observeFoo: function() {
var error = new Error();
console.log(error.stack);
}.observes('foo')
Or, just put a breakpoint inside the observer and stop there and look at the stack. This might be better because it will allow you to see the local variables of the various stack entries, one of which will be the property name whose change triggered the observer.
来源:https://stackoverflow.com/questions/31749330/how-do-you-retrieve-where-a-property-queryparams-changes-with-ember