Question

For example, I am using Google Maps API and I want to see all possible fields and methods.

<script type="text/javascript" src="https://www.google.com/jsapi"> </script>
<script type="text/javascript">
var ge;
google.load("earth", "1");

If I type google. I want to see every available functions and fields

For now I use Visual Web Developer 2010 Express and it shows only base methods available for all objects like toString().

Was it helpful?

Solution

To my knowledge not yet, but you can use this simple code to "print" all that's in an object.
It is crude but it works :)

// Obj.keys(); strict
// Object.getOwnPropertyNames( obj ) strict
get_keys = function get_keys (obj) {    // all inhereted keys

    var keys = [], key;

    for(key in obj)
    {
        //if (obj.hasOwnProperty(key)) {keys.push(key);}
        keys.push(key);
    }
    obj = key = null;
    return keys;
};
stringify_object = function stringify_object(obj){

    var keys = get_keys(obj),
    str = '',
    i, len = keys.length;

    for(i=0; i < len; ++i)
    {
        str += i + ": " +keys[i] + ' : ' + obj['"'+keys[i]+'"'] +'\n\n';
    }

obj = keys = i = len = null;
    return str;
};
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top