Christof Donat schrieb:
Hi,

// Implementation:
$.require = function(names) {
        $.each(names.split(","), function(i, n) {
                if( !$.fn[n] || $[n] )
                        throw "required plugin " + n + " not found";
        });
}
// Usage:
$.require("autocomplete,dimensions");

Why not use OpenAjax?
http://ejohn.org/blog/thoughts-on-openajax/
If you would like to load your js files that way as well, your API looks much like the jsPax API. I was planing to make an "OpenAjax"-package for jsPax that uses the jsPax package information, but did not get around to do it.
The idea was to give users of plugin a hint which dependencies are not loaded yet, without any fancy packaging on the clientside. And to achieve that with as little code as possible in jQuery core.
$.dimensions = {};

OK, here we use $package('dimensions',{}) with jsPax - not really more complicated.
Yeah, but I don't see that we actually gain anything that way.

--
Jörn Zaefferer

http://bassistance.de

Reply via email to