knockout/knockout — pull request #1373 by cwohlman (2014-03-25 18:50:47+00:00)
Title: Attach Knockout Observables to object prototypes

I've created two utility functions on ko.utils:

- ko.utils.protoObservable
- ko.utils.protoComputed

Each of these functions is a wrapper for their respective knockout functions. When called they will lazily create the observable (or computed, as the case may be) and attach it to the instance object.

Example:

```javascript
var MyObject = function () {
this.x = 5
};
ko.utils.protoObservable(MyObject, "y");
ko.utils.protoComputed(MyObject, "xy", function () {
return this.x + this.y();
};
var myObject = new MyObject();
myObject.y(4);
myObject.xy(); // returns 9
```
I've added tests, which double as a description of the protoObservable and protoComputed properties and their usage.

Would this be a helpful addition to knockout?