Skip to content

Commit

Permalink
Debug printing improvements, check theory about check box & radio button
Browse files Browse the repository at this point in the history
Radio button works across clients with update GUI but not otherwise. This is wrong, but worth doublechecking for check boxes. Better JS object printing.
  • Loading branch information
gbracha committed Aug 15, 2024
1 parent 2950d6c commit 6e09d23
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 0 deletions.
Binary file modified samples/CroquetCounterApp.vfuel
Binary file not shown.
Binary file modified samples/CroquetHopscotchDemo.vfuel
Binary file not shown.
Binary file modified samples/CroquetHopscotchFontDemo.vfuel
Binary file not shown.
Binary file modified samples/CroquetHopscotchGestureDemo.vfuel
Binary file not shown.
Binary file modified samples/CroquetTodoMVCApp.vfuel
Binary file not shown.
29 changes: 29 additions & 0 deletions samples/croquetpsoup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3416,6 +3416,35 @@ function replaceUndefined(obj) {
return obj;
}

function printObjectTree(obj, indent = 0) {
// Create a string of spaces for indentation
const indentString = ' '.repeat(indent);

// Check if the current value is an object and not null
if (obj && typeof obj === 'object') {
// If it's an array, print each element
if (Array.isArray(obj)) {
console.log(indentString + '[Array]');
obj.forEach((item, index) => {
console.log(indentString + ` [${index}]`);
printObjectTree(item, indent + 4);
});
} else {
// If it's an object, print each key/value pair
console.log(indentString + '{Object}');
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
console.log(indentString + ` ${key}:`);
printObjectTree(obj[key], indent + 4);
}
}
}
} else {
// If it's not an object, just print the value
console.log(indentString + obj);
}
}

function storeModelAndView(m, v) {
theModel = m;
theView = v;
Expand Down

0 comments on commit 6e09d23

Please sign in to comment.