Browser history sniffing with Dojo

Posted by Mike on Jan 14th, 2010

Niall Kennedy posted a now-famous article about using some browser trickery to determine what websites a user on your site has visited. I’ve taken that concept and created a module that can be used with the Dojo Toolkit javascript framework.
It provides two methods that you can use in your code, isVisited and isAnyVisited.
One important [...]


Readying Javascript for the Enterprise with Automated Testing

Posted by Mike on Jan 5th, 2009

<flame>
Javascript seems to gets left in the dust when we consider code quality. It’s been rigged, scattered, and smeared every which way from Sunday. Most sites of significant complexity have a severe amount of legacy, rotting code buried deep in a countless number of files. There is little separation of concerns in [...]


Decorate a method with Dojo

Posted by Mike on Oct 2nd, 2008

Here’s a quick example of how to incorporate the Decorator Pattern into your javascript code using the Dojo framework. Rather than decorating an entire class, this example merely decorates a single function, extending the original function with some extra logic.

// Instantiate widget class
var w = new core.widget.MyWidget();
 
// Decorate the original "method1" function
var _old_method1 = [...]


Cancel dojo XHR in progress

Posted by Mike on Sep 3rd, 2008

Often you run across a use-case where you want users to be able to fire off an XMLHttpRequest while another is ongoing.  Sometimes, the requests are independent and affect independent objects as a result.   But othertimes, the callback functions from the two could be affecting the same event.
For example, imagine you have a list of [...]