Thursday, March 19th, 2009

Observe Dojo Events

Category: Bookmarklets, Dojo, Utility

<>p>Speaking of bookmarklets, in a recent blog post Nathan Kurtyka discusses a scenario familiar to many Ajax developers:

However, I can’t even begin to think about how much time I’ve wasted hunting through source code hoping there might be some event I can subscribe to (e.g. “What event is published when someone clicks on a Tree widget node?”).

So naturally, he created a little something to scratch that itch:

I created a Dojo bookmarklet that can be used to log all events to the console.

So to not only see how rich Dojo is with event publishing (you probably haven’t been leveraging either), but to also see the bookmarklet in action, head on over Dojo Campus. Just enable Firebug, give the bookmarklet a click, browse the demos.. and behold — events everywhere!!

Check out the blog for the bookmarklet.

Related Content:

3 Comments »

Comments feed TrackBack URI

I think this is the way things are going – Sproutcore and Cappuccino made it clear that a decent observer chain is necessary for JS UI development. Let’s hope there are more enterprising developers like this out there!

Comment by flipsasser — March 19, 2009

If you’d like to do the same with ExtJs, use the following link as a bookmarklet:


<a href="javascript:(function(){
var a,l,o=(Ext?Ext.util.Observable.prototype:false);
if (!o) {
alert('Ext not in page');
return;
}
if (!(l=console?console.log:false)) {
alert('Use Firefox with Firebug');
return;
}
o.fireEvent=o.fireEvent.createInterceptor(function(evt) {
a = arguments;
l('Ext fired event ',evt,' with args ',Array.prototype.slice.call(a, 1, a.length));
});
})();">Log all Ext events</a>

Comment by ExtAnimal — March 23, 2009

The bookmarklet was rehosted here (since that link is dead): http://pastebin.com/HF1tma4S

Comment by wahnfrieden — January 12, 2011

Leave a comment

You must be logged in to post a comment.