I have following code
function Model(onChanged) {
this.array = new Array();
this.onChanged = onChanged;
}
Model.prototype.push = function(val) {
this.array.push(val);
if (typeof(this.onChanged) !== 'undefined') {
this.onChanged();
}
}
console.log(JSON.stringify(Model.prototype));
console.log(JSON.stringify(Model.prototype.push));
And this gives me
{}
undefined
I’ve looked through some qml js code and there were same classes definitions so I can’t get why this doesn’t work for me. And autocomplete says that existing classes like Object, array, etc have prototype property. I tried to subclass them but got the same result.
Try
JSON does not handle function or class definitions and therefore shows empty results.