From: Michael P. <mp...@ph...> - 2001-02-24 04:59:44
|
it checks to see if the file has already been loaded. Alsop, my making the libaries a series of boolean values, check can be made for individual files instead of checking for the created objects. eg: if (dynapi.ext.keyevent) would check to see if that particular file has been included. Pascal wrote: > what exactly is the idea behind it? (can't figure it out :) > > Pascal Bestebroer (pb...@oi...) > Software ontwikkelaar > Oberon Informatiesystemen b.v. > http://www.oibv.com > > > -----Oorspronkelijk bericht----- > > Van: dyn...@li... > > [mailto:dyn...@li...]Namens Michael > > Pemberton > > Verzonden: vrijdag 23 februari 2001 4:35 > > Aan: dyn...@li... > > Onderwerp: [Dynapi-Dev] Advanced include method > > > > > > 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 > > > > > > > > > > _______________________________________________ > > Dynapi-Dev mailing list > > Dyn...@li... > > http://lists.sourceforge.net/lists/listinfo/dynapi-dev > > > > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/lists/listinfo/dynapi-dev |