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

核能气质少年 提交于 2019-12-12 02:38:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!