I've split the library loader in half.  The package and object handling code is 
included in dynapi.js by default (adds 6Kb including comments).  This allows you to 
still do dynapi.library.include('Object'), without having any of the dynamic loading 
capability.

dynapi.library.setPath('src/lib');

Then optionally:

dynapi.library.include('dynapi.library');  // adds dynamic loading methods to 
dynapi.library

Also, you can remove the DynAPILibrary object from dynapi.js completely, and you will 
then only have dynapi.library.setPath() available.  This way you can still include the 
script manually if you prefer that way.  In production systems, it's probably better 
include scripts manually anyway.

But in other cases you will probably want to make use of the dynamic loader.  A great 
example is for staged loading.  You can create a page, totally laid out correctly, 
then load the mouse events, a window widget or whatnot dynamically so the initial page 
load is offset.  And yet, other cases where you have enormous amounts of code you need 
loaded up that do completely different tasks (JS applications), you need a dynamic 
loader without question.  You could generate javascript code on the fly, and then load 
up a widget to display your data, or visa versa.

I going to try adding Michael's Java load mechanism to the library so that you can 
have synchronous loading (I believe that's what you meant by loading a script when 
needed) using the same syntax.

Regards,
Dan Steinman


On Mon, Jan 07, 2002 at 04:46:53PM +0100, Jordi Ministral wrote:
> Personally I've never had any project so big that I could not handle all 
>   script loading by myself via <script src=... </script>. Ok, sometimes 
> I forget some file but it takes as long as one minute in the worst of 
> cases to figure out.
> 
> I'm not saying I'm against the loader thing but I don't even have an 
> opinion about how it should be done. When it comes to me, I'd rather cut 
> the whole loading stuff and hand-code the external script calls if by 
> doing so I can produce a website which is 10k smaller.
> 
> If we manage to achieve asynch loading ( an object is loaded when it is 
> needed ), something I really doubt given the nature of browsers 
> themselves, then I makes sense.
> 
> Regards from the Euro world, were everything is more expensive than it 
> was ( in spite of the guvernamental propapaganda we've been bombed with ).
> 
> ---
> 
> 
> 
> _______________________________________________
> Dynapi-Dev mailing list
> [EMAIL PROTECTED]
> http://www.mail-archive.com/dynapi-dev@lists.sourceforge.net/

_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/dynapi-dev@lists.sourceforge.net/

Reply via email to