Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

query javascript class for property

Posted on 2012-03-27
3
Medium Priority
?
155 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 900 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

618 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