[ng-dhtml] directory structure

Mark D. Anderson mda at discerning.com
Thu Sep 16 18:08:46 CDT 2004


> > perhaps the loader/importer gets generated at build time so that
> > it knows which classes are where, e.g.:
> >
> > import('foo.bar.baz');
> >
> > imports /src/foo/bar/baz.js at dev time and /src/foo_lib.js at
> > production time.

The bootstrap code i checked into the defunct repository offered
to work up the directory tree looking for packaged js files.
Since anyone who really cares about performance won't usually
be doing dynamic loading anyway (just putting script elements
in the head), I figure this is ok.
Here is a source excerpt....

/**
* loadModule("A.B") first checks to see if symbol A.B is defined.
* If it is, it is simply returned (nothing to do).
* If it is not defined, it will look for "A/B.js" in the script root
directory, followed
* by "A.js".
* It throws if it cannot find a file to load, or if the symbol A.B is
not defined after loading.
* It returns the object A.B.
*
* This does nothing about importing symbols into the current package.
* It is presumed that the caller will take care of that. For example, to
import
* all symbols:
*
*    with (dojo.hostenv.loadModule("A.B")) {
*       ...
*    }
*
* And to import just the leaf symbol:
*
*    var B = dojo.hostenv.loadModule("A.B");
*    ...
*
* dj_load is an alias for dojo.hostenv.loadModule
*/
dojo.hostenv.loadModule = function(modulename, exact_only) {
...

-mda



More information about the NG-DHTML mailing list