Martin Cooper wrote:
>[...] BTW, although it's not my favourite construct, you can often use
JavaScript's 'with'
>construct if you _really_ want to shorten the code. [....]
...and I wrote:
> I'll accept a plain "xap" until there's a simple, cheap, import
mechanism around
I'll admit to being ignorant of "with" except for the Dojo coding
standard's enjoinder against it; now that I take a good look at it,
though, it looks like the import-equivalent I would like, when combined
with a global variable
org.apache.xap = new Project() ;
with constructors and package-level variables scoped under that global
// produces a Package object org.apache.xap.xml
// for scoping using "with", loading, aggregated
unit-testing?,...
org.apache.xap.addPackage("xml");
// org.apache.xap.xml.dom
org.apache.xap.xml.addPackage("dom");
org.apache.xap.xml.dom.XapElement = function(){...}
What do people think? This as presented above might be too elaborate,
and probably reinvents chunks of dojo; at the very least, though, I like
the idea of packaging with a top-level global object so that we have no
other globals to collide with anyone else's.
How do other large javascript projects in Apache do this (are there
any)?