Introduction to Illuminations for Developers

5 years ago by sroussey
Tags extjs

It makes Firebug know all about ExtJS (and you can try with Dojo, SproutCore, Closure, qooxdoo, and jQueryUI, though they are in beta status). And it is very very handy, and so let's discuss a few of the features (using ExtJS3 as the example framework):

Object Naming

It presents the framework objects in a smarter way. It recognizes what they are and shows the whole name, like "Ext.DataView" instead of "Object" in the console and the other Firebug panels. And instead of random properties being appended, it looks for a ID-ish and a Value-ish property to show. This gives you an idea what you are looking at when you are debugging. See the example without and with Illumination:


Element Highlighting

Now, when you hover the mouse over the Ext.DataView above, it will highlight the component on the page. In the case above, the coder didn't give a descriptive itemId or name, so hovering over it does the trick -- it shows you exactly what that object is all about. This works for Ext Components and for Ext Elements. It even works for Ext Composite Elements -- it highlights all of its nodes on the page!

Contextual Menu

When you right click on an element in Firefox, Firebug adds an "Inspect Element" menu item to open Firebug and bring you to that element in the HTML panel. Illumination does the same sort of thing, but tries to find the best match: ideally some sort of UI widget, else an Ext Element.


Illumination Panel

There is a new panel added to Firebug called Illuminations, and when you use the contextual menu above, this is where it brings you. The Illumination panel is the place to inspect ExtJS objects: Widgets (usually derived from Ext.Component, but not always), Data (Ext stores, records, fields), and Elements (Ext.Element and its brethren). These views show the hierarchical structure of your code:


It really takes some playing around with all of the above to get a feel of how useful and fun debugging can be again.Try this example page and look at the DataView, and generally browse around. You can click on a data store and look at the records in the Records side panel! 

Other side panels include Properties (sorted by the object that defined the property) and Methods. See what Events are connected. There is even a Docs side panel that will bring up documentation for the widget you are looking at! And the full array of DOM related side panels showing you where in the DOM the component is at, that DOM element's CSS, etc.

And whatever you click on can be found in the $0 variable in the console -- which is awesome if all the references to that object are hidden in JavaScript closures!

Have fun!

Does it work with Sencha Touch 2.0?

This looks like a very nice and needed product, but I had one question-- does it work with Sencha Touch 2.0? Whenever I open a page that links to the Sencha 2.0 library I get a message in the Illuminations tab stating:

"Looking for a page with a Sencha/ExtJS, Dojo Toolkit, SproutCore, qooXdoo, Google Closure Library, YUI, or jQueryUI JavaScript framework on it."

If I open a very similar page that uses Sencha 1.1.0, no problems. Each of these pages has links to the appropriate Sencha Touch debug javascript files and the links are quite simple, no crazy paths or anything like that.