Added: knockout.js observable toJSON()

This commit is contained in:
djmaze 2020-10-20 15:39:14 +02:00
parent 3a315bc543
commit 36fa52307f
3 changed files with 10 additions and 2 deletions

View file

@ -37,6 +37,10 @@ ko.observable = initialValue => {
// Define prototype for observables
var observableFn = {
'toJSON': function() {
let value = this[observableLatestValue];
return value.toJSON ? value.toJSON() : value;
},
'equalityComparer': valuesArePrimitiveAndEqual,
peek: function() { return this[observableLatestValue]; },
valueHasMutated: function () {