Solved

query javascript class for property

Posted on 2012-03-27
3
149 Views
Last Modified: 2012-03-31
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
Comment
Question by:bhomass
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 300 total points
ID: 37774991
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
 

Author Comment

by:bhomass
ID: 37792441
this works.

                                                var properties = [];
                                            for (var propertyName in form){
                                                  properties.push(propertyName);
                                            }
0
 

Author Comment

by:bhomass
ID: 37792444
good pointer from expert. I had to do some more research to get what I needed.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question