[Dojo-interest] Re: Designing for extensibility: naming widgets

Shane O'Sullivan shaneosullivan1 at gmail.com
Mon Apr 24 03:12:40 MDT 2006


Yes, I understand how this makes the dojo.require("myNS.myWidget")
work, but does it enable me to include widgets as follows:

<dojo:Button ..../>
<myNS:myWidget .... />

I was under the impression that the dojo namespace was still the only
supported namespace when defining tags.

I think it would be very useful to extend the namespacing model to
cover both the dojo.require() statements and the tag-based
definitions.  What would be very useful would be to make it possible
to remove any dojo.require statements from being required, and instead
have the namespace be able to handle requests for the instantiation of
a widget.  For example, instead of simply having

<script>
    dojo.require("myNS.myWidget");
</script>
....
<myNS:myWidget .../>

We could simply have:
    <myNS:myWidget .../>
and the dojo.defineNamespace method could take a fourth parameter,
which is a package resolver.  For example:

function resolver(name){
    if(name == "myWidget") dojo.require("myNS.myWidget");
    else if(name == "myOtherWidget") dojo.require("myNS.myOtherWidget");
}

dojo.defineNamespace("myNS", "../myNS/", "myNS", resolver);

This change would make it possible to have a Javascript-less web page
using just a Dojo  script include and html tags.  What do people
think?

Shane


On 24/04/06, Bill Keese <bill at dojotoolkit.org> wrote:
> You can do it already; the link below is just changing the API to make
> it a little bit easier (1 line instead of 3 lines, or something like that).
>
> http://dojo.jot.com/FAQ#How%20can%20I%20use%20JavaScript%20in%20a%20namespace%20outside%20%22dojo%22?
>
> Shane O'Sullivan wrote:
> > Has anyone taken on developing this namespacing feature?  I've looked
> > in the nightly builds, and there is no sign of it, but is anyone
> > working on it on their own?  If not, are there any plans to get this
> > into an upcoming release, and if so, when?  It seems to me that this
> > would be an extremely useful addition to Dojo, enabling the
> > integration of numerous other widget libraries with Dojo.
> >
> > Shane
> >
> > On 09/02/06, Paul Sowden <paul at idontsmoke.co.uk> wrote:
> >> On 5 Feb 2006, at 20:05, Paul Sowden wrote:
> >>
> >>> No one wrote up the proposed API in the end [...]
> >> OK, I clearly lied, it turns out that I wrote up the new APIs here:
> >> <http://dojotoolkit.org/~psowden/newapis.html>
> >>
> >> It also turns out that we did settle on the argument order that you
> >> mentioned Brain.  I guess this is why you write things down.
> >>
> >> --
> >> Paul Sowden
> >>
> >> _______________________________________________
> >> Dojo-interest mailing list
> >> Dojo-interest at dojotoolkit.org
> >> http://dojotoolkit.org/mailman/listinfo/dojo-interest
> >>
> > _______________________________________________
> > Dojo FAQ: http://dojo.jot.com/FAQ
> > Dojo-interest at dojotoolkit.org
> > http://dojotoolkit.org/mailman/listinfo/dojo-interest
> _______________________________________________
> Dojo FAQ: http://dojo.jot.com/FAQ
> Dojo-interest at dojotoolkit.org
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>


More information about the Dojo-interest mailing list