I have a general question about functions as prototypes on Knockout Objects. Currently, I am having great luck using the following means to extend the prototype of an object, however I'm curious as to what benefits and/or pitfalls I could be running into by doing so.
ko.utils.extend(objectModel.prototype, {
makeAlert: function() {
console.log('alert');
},
makeWhoopie: function() {
console.log('whoopie');
},
});
The other way would be the common js approach
objectModel.prototype.makeAlert = function() { console.log('alert'); }
objectModel.prototype.makeWhoopie = function() { console.log('whoopie'); }
The only other way I've used the ko.utils.extend method was when implementing validations.
Question: Does the knockout utility method for extending prototypes carry with it any additional overhead that would deem unnecessary? Is there a preferred way for this? I do so like keeping my methods separate from my observables.