Monday, September 17th, 2007

Yojo: Loading YUI with the Dojo loader

Category: Dojo, Yahoo!

James Burke has made a call out for a little bit of collaboration as he discussed Yojo: Loading YUI with the Dojo loader:

I like Dojo 0.9, and I think it has a great solution to loading JS modules dynamically. The core of the Dojo loader has been there since the beginning of the project, but with the addition of the xdomain loader, it really shines (disclaimer: I work on the xdomain loader). It allows anyone to use all of Dojo from a CDN without having to download it.

The loader is a great fit for any JavaScript library that has more than a couple of files to load, and where the files can have dependencies on other files. I touched on this topic during my Ajax Experience talk about Dojo’s xdomain loader. This post explores a real-world example: using the Dojo loader to load YUI.

First, a demo. Here is a page that loads the YUI rich-text Editor using the Dojo loader. If you have a DOM inspector tool, you can verify that the modules where loaded by looking at the dynamically created script elements inside the head element.

James talks more about the implementation, and then the call out:

I would like to see YUI and Dojo converge on using the same type of loader for their code. There is a generic need for this functionality, and it would be good to start standardizing on an approach.

Obviously I would like to start with the Dojo loader and the dojo.provide/require approach and make any modifications that YUI might need to fulfill their needs. I am sure the Dojo loader code could use improvements, in particular the xdomain loader. Look at the file. Isn’t that scary? It scares me and I wrote it! Let’s see if we can make it better.

I am also open to other paths if Dojo’s loader does not seem like the way to go. However, I would like some solution that keeps encapsulation and can leverage a build process for optimizations.

This is also an important test case for further YUI/Dojo collaborations. We are solving lots of the same issues, and I think we will serve the Open Web better if we work together rather than separately.

Hear, hear!

Posted by Dion Almaer at 6:41 am
3 Comments

+++--
3.2 rating from 30 votes

3 Comments »

Comments feed TrackBack URI

gee http://tech.groups.yahoo.com/group/ydn-javascript/message/10686

although i stopped using YUI not too long after in favor of jQuery

Comment by Wade Harrell — September 17, 2007

well, since the basic demo of the concept is not working at all, what should I say ? Useless talk …

Erreur : uncaught exception: Could not load cross-domain resources: YAHOO.dom.dom YAHOO.connection.connection YAHOO.element.element_beta YAHOO.container.container YAHOO.menu.menu YAHOO.button.button_beta YAHOO.editor.editor_beta

Comment by Laurent V. — September 29, 2007

Hey Laurent && other Gentle readers ,

Look again. This test of loading YUI with the Dojo xdomain loader
aka “yojo” test with YUI Editor DOES WORK now !!

See it work for yourself using FFox 2.0.0.16+ or better –
go to link @ http://www.tagneto.org/blogcode/yojo/yojo_editor.html

Maybe it was IE 6.x that was barfing up on you ?
IE barfs on anything new.

Comment by wickedmarc — August 31, 2008

Leave a comment

You must be logged in to post a comment.