我正在阅读knockout.js文档并且多次阅读"评估者"一词,就像在这里一样
http://knockoutjs.com/documentation/computedObservables.html
和
http://knockoutjs.com/documentation/computed-dependency-tracking.html
有人可以解释一下评估函数是什么吗?
定义计算的observable时,如下所示,请注意您将匿名函数传递给ko.computed:
this.fullName = ko.computed(function() {
return this.firstName() + " " + this.lastName();
}, this);
Run Code Online (Sandbox Code Playgroud)
在这种情况下,传递的函数是:function() { return this.firstName() + " " + this.lastName(); }- 在文档中称为评估函数.
由于淘汰赛使用此功能重新评估计算的可观测每当依赖性变化的值.
... 每当任何依赖项发生变化时,您的评估函数将被调用一次...
参考:http://knockoutjs.com/documentation/computedObservables.html