The following is a modified version of the DynAPI.include method.
include : function(src,path) {
src=src.split('.');
if (src[src.length-1] == 'js') src.length--;
var pckg=src[0], grp=src[1], file=src[2],
path=path||DynAPI.librarypath||'';
if (path.substr(path.length-1) != "/") path += "/";
if (file=='*') {
if (DynAPI.packages[pckg]) group=DynAPI.packages[pckg][grp];
if (group) {
for (var i in group)
if (group[i]!=true) {
document.write('<script
src="'+path+pckg+'/'+grp+'/'+i+'.js"><\/script>');
group[i]=true;
} else DynAPI.errorHandler("The package has already
been loaded.");
} else DynAPI.errorHandler("The following package could not
be loaded.");
} else if (DynAPI.packages[pckg][grp][file]!=true) {
document.write('<script
src="'+path+src.join('/')+'.js"><\/script>');
DynAPI.packages[pckg][grp][file]=true;
} else DynAPI.errorHandler("The package has already been
loaded.");
}
I've replaced the libraries so that they are defined as a series of
boolean values
api : { browser:false, layer:false, document:false, events:false },
Is this worth implementing in the API. I see that it would require
rewriting the way that packages are declared.
--
Michael Pemberton
mp...@ph...
ICQ: 12107010
|