简体   繁体   中英

How do you retrieve where a property/queryParams changes with ember?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM