I believe Yehuda has been working on something like Dan describes:
http://dev.jquery.com/browser/branches/yehuda-dev/register.js

I think I like what Jörn presents but not the name. It makes me think
it would load the necessary files. Maybe $.required().

--
Brandon Aaron

On 4/30/07, Jörn Zaefferer <[EMAIL PROTECTED]> wrote:

Dan G. Switzer, II schrieb:
> Guys,
>
> It occurred to me last night with the growing list of plug-ins and the fact
> that so many plug-ins now are dependant on other plug-ins, that we should
> try to add a couple of functions to the jQuery core for registering plug-ins
> and detecting if a plug-in has been registered.
>
I like the idea Dan!
> So, to register a plug-in, you'd add something like this to a plug-in:
> $.plugin.register("autocomplete");
>
> And then when writing a plug-in that's dependent on some other plug-in, you
> could check for loaded plug-ins:
> $.plugin.find(["dimension","blockui","below"]);
>
> I'm just thinking that maybe the core library needs something to help
> plug-in authors to manage the dependencies of their plug-ins--in order to
> help developers using their plug-ins.
>
> If we at least added a few core methods for tracking, we could expand the
> architecture later if need be.
>
> Does this make sense to anyone else?
>
Yes! How about this:

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

Of course this doesn't work with dimensions as it is. But the easiest
approach would be to add this line to the dimensions plugin:

$.dimensions = {};

I don't see any need for explicit registration methods.

--
Jörn Zaefferer

http://bassistance.de


Reply via email to