Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28978

Re: Recursively enumerating the global object

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: Recursively enumerating the global object
Date 2015-12-05 10:16 +0100
Organization PointedEars Software (PES)
Message-ID <1696024.u3LjWGVPF4@PointedEars.de> (permalink)
References <global-20151202015022@ram.dialup.fu-berlin.de> <global-dump-20151202024621@ram.dialup.fu-berlin.de> <enum-all-20151204211922@ram.dialup.fu-berlin.de> <functions-20151205013202@ram.dialup.fu-berlin.de>

Show all headers | View raw


Stefan Ram wrote:

> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>>It worked when I inserted the script into a web page.
>>>Here's the last version:
>>I'd like to show /all/ the information (except function
>>bodies) that can be reached via the global object in
>>Mozilla® Firefox. Please let me know if I still should
>>have missed some information.
> 
>   My code used to produce about 1600 lines, but now it
>   produces a whopping 19000 lines!

You are making the mistake to equate quantity with quality.

>   I remembered that functions are objects too, and now also dump all 
>   functions as object.
> 
>   Finally, a use case for the fall-through in a switch-statement!
>   An excerpt from the current source code (simplified):
> 
> ...
> switch( typeof( arg ))
> {
> 
>   case "function":
>   writeline( path + " = " + t + " : " +( arg.name ? arg.name : "" ));
> 
>   case "object":
>   ...

I commend your efforts (even though I still find your code style suboptimal 
at best).

But you do not realize that you are not the first person to try this, that 
function serialization as such and certainly in advance is not a good idea 
(especially writing out function code in HTML without escaping), and that 
both the built-in script consoles and Firebug provide this information in a 
more user-friendly and context-sensitive way:

Just type the expression, e.g. “Math” and click the result, or type, e.g. 
“inspect(Math)” and see the result in the Inspector pane (right-hand side if 
the console is displayed horizontally, on the bottom if vertically).  Also, 
the console (in single-line mode; Firebug also has a very useful editor 
mode) has auto-completion and tab completion.

<http://devtoolsecrets.com/> (see also the FAQ)

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next | Find similar | Unroll thread


Thread

Re: Recursively enumerating the global object Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-12-05 10:16 +0100

csiph-web