Now we are going to redo the
script section of code using
computed. The term
pureComputed was inspired by the concept of pure functions as a style of programming. It is nothing you need to understand to use so don't get caught up with the semantics of the name as there is no practical win as far as learning how these pure computations benefit us here.
When Knockout has something watching, a computed item is called a subscriber. Thus, it is considered to be a subscriber dependency. If we use the
pureComputed method versus the
computed method, Knockout will not calculate the value when there are no subscribers. This, of course, adds more speed to our processes by reducing calculations that aren't needed ...