Remi Arnaud
Remi Arnaud

Reputation: 475

What is the right way to introspect a qooxdoo object?

I want to list all members of a qooxdoo object. I found a way to do it, but I assume there must be a cleaner way?

for (var key in obj) {
  if (key.startsWith('$$user_')) {
    msg += 'name='+key.substring(7)+' = '+obj[key]+' [type='+typeof(obj[key])+']';
  }
}          

Upvotes: 3

Views: 170

Answers (1)

geonik
geonik

Reputation: 181

Assuming it is properties you are interested in, you can use

var classProperties = qx.util.PropertyUtil.getAllProperties(obj.constructor);
for(var propertyName in classProperties) {
    ...
}

http://tinyurl.com/c4b2l5m

Upvotes: 4

Related Questions