KO mapping with pureComputed
For a bug report
by db_dev
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.0/knockout-debug.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout.mapping/2.4.1/knockout.mapping.js"></script>
JavaScript
function Person(data){
var self = this;
self.Name = ko.observable(data.name);
self.NeverShouldBeCalled = ko.computed({
read: function(){
alert("The pure computed that is never bound was called!");
},
deferEvaluation: true});
}
person = ko.mapping.fromJS({ name: 'John'}, {
create: function(options) {
return new Person(options.data);
}});
alert("all done");