Click here to Skip to main content
15,886,518 members
Articles / Programming Languages / C# 4.0
Tip/Trick

JavaScript 'Object' Browser

Rate me:
Please Sign up or sign in to vote.
4.00/5 (1 vote)
11 Mar 2013CPOL2 min read 10.6K   272   5   1
A tool like the object browser to browse the interface of documented JavaScript and JavaScript code snippets.

Java Object browser

Some time ago I was working on a Web-project that had already a load of Java jQuery files. Some came from the Web-designer, some from external developers, some were standard. While working on them, I discovered that some added functionality already existed or existed with a slightly different interface. Some files were meant to be shared, but some guys changed them not being aware of the sharing.

Of course if everything goes perfect, this won’t happen. But am I really to blame to make my own Fill Select function, because I am not aware that there is already one in a file called General.js? A JavaScript file can be documented, providing intelligence when referenced. But can you blame the developer not making these doc files and how do I know which files to reference?

To contribute to a more organized way of JavaScript development, I developed a browser in a way similar to the Object browser. The idea is twofold: first to organize Java code snippets in a logical categorized way (Dates function apart from Select functions), secondly parse the documentation tags in such a way that they can be displayed in the browser. You can browse the JavaScript interface and you can merge these several code blocks to a separate file (leaving out the annotated tags).

It looks like:

Sample Image

The project consists of a parser that parses a JavaScript that is either embedded as a source or loaded from file and of a Windows Forms application that displays the parsed result. At first I thought why not include a minimize function as well. One annotated source could then be translated to a normal or a minimized file. I dropped that idea because Minimize functionality is already available and can be integrated in MSBuild.

At first I didn’t intend to share this with the developer world, so I have not tested it thoroughly (due to limited time). The code itself doesn’t bear that much complexity, so examining it won’t be that difficult. In the parsing I make use of Reactive Extensions that is worth studying, but don’t forget to include it. So take this as the first imperfect version. Comments are welcome.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Netherlands Netherlands
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 4 Pin
Prasad Khandekar13-Mar-13 21:14
professionalPrasad Khandekar13-Mar-13 21:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.