I was reading knockout.js docs and got to read many times of the term "evaluator" a lot , like in here
http://knockoutjs.com/documentation/computedObservables.html
and
http://knockoutjs.com/documentation/computed-dependency-tracking.html
Can somebody please explain what an evaluator function is ?
When you define a computed observable, such as the following, notice that you are passing an anonymous function to ko.computed:
this.fullName = ko.computed(function() {
return this.firstName() + " " + this.lastName();
}, this);
In this case the the function being passed is: function() { return this.firstName() + " " + this.lastName(); } - which is referred to as the evaluator function in the documentation.
Because Knockout uses this function to re-evaluate the value of the computed observable whenever a dependency changes.
... your evaluator function will be called once each time any of its dependencies change ...
Ref: http://knockoutjs.com/documentation/computedObservables.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With