O'Reilly logo

KnockoutJS Web Development by John Farrar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Purifying our computations

Now we are going to redo the script section of code using pureComputed versus 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required