简体   繁体   English

您如何检索属性/ queryParams在余烬中发生的变化?

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

Following this post : Ember-data resets queryParam to default value , 在这篇文章之后: Ember-data将queryParam重置为默认值

I got another question. 我还有一个问题。 Can I retrieve the place where a property/queryParam changes with some kind of wizardry? 我可以通过某种向导来检索属性/ queryParam发生变化的地方吗? 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. 这可能会更好,因为它将允许您查看各种堆栈条目的局部变量,其中之一就是属性名称,其更改触发了观察者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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