Solved

query javascript class for property

Posted on 2012-03-27
3
148 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
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)

810 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