• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 157
  • Last Modified:

query javascript class for property

I have a javascript class (one from Sench Touch component class). I would like to be able to query that class to figure out what events it supports.

Is there a way to do this in javascript what is equivalent to reflection in Java?
0
bhomass
Asked:
bhomass
  • 2
1 Solution
 
Gurvinder Pal SinghCommented:
if you need to check whether it has a particular method or property or not, then you simply needs to check

if ( classname.methodOrPropertyName )
{
   //yes supports
}

check this too
http://stackoverflow.com/questions/595766/how-to-determine-if-native-javascript-object-has-a-property-method
0
 
bhomassAuthor Commented:
this works.

                                                var properties = [];
                                            for (var propertyName in form){
                                                  properties.push(propertyName);
                                            }
0
 
bhomassAuthor Commented:
good pointer from expert. I had to do some more research to get what I needed.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now