Dan Steinman wrote:

>I wasn't able to properly get synchronous loading working in the first place, but I 
>don't believe that asynch loading is much more difficult to work with.  I have load 
>handlers which are called when a script, or several scripts are finished loading, or 
>are already loaded.  After some further thinking I think we'll be able to get 
>dependencies to be defined in the files anyway - as long as some coding guidelines 
>are followed precicely.  I haven't tried it yet but such a guideline would go like 
>this:
>
>- in the script file include a callback which sets it's dependencies:
>  dynapi.library.setDepencency('MyObj','DepObj');
>
>- create the constructor as usual:
>  function MyObj() {
>     this.DepObj = DepObj;
>     this.DepObj();
>  }
>
>- I have a new function to wrap the prototype assignment:
>  MyObj.setPrototype('MyObj','DepObj');
>
>- In the main() function, define the rest of the methods, or scrap the above command, 
>and do a manual prototype assignment here also:
>
>  function main() {
>     MyObj.prototype.myMethod = function() {};
>  }
>
>- Include a check to call main() if the script is included manually (not through the 
>lib loader)
>
>  if (!dynapi.loaded) main();
>
It is this sort of stuff that needs to be seen to be understood.  As 
someone who works in a "break it to understand it" method, it is alot 
quicker to understand something when looking at the whole picture. 
 Currently it is like looking at a rubix cube and every now and then, 
the colours change :)

>...
>This library loader is both easier to work with and more powerful, and is not 
>manditory.  You could still use the package include with minimal changes, but I 
>highly doubt you'd want to.  You can also include the script tags manually and have 
>no library loader at all.
>
Without seeing any of the "codebase" in even a pre-alpha stage, it is a 
bit hard to work out what the inner parts of the loader are doing.

For example, currently, the browser executes the code in the order that 
it is included.  This is equiv to the use of a sync loading function. 
 Once you start downloading more than one file at once, we then need to 
keep track of the loading ourselves.  As has been shown with the 
existing attempts at load tracking (loadpanel, loadlayer, dynimage, etc) 
this can become very buggy, very quickly.

>I think it's better to have a codebase that is fully working before letting others 
>critique it.  You can critique the syntax (and how it will be used) though, that's 
>why I was making note of them.
>
>Cheers,
>Dan Steinman
>
In my own code, I use the sync method of loading to load required files 
as they are needed.  For example, my Cell object (similar to the Label 
widget) only requires the mouse events code to be loaded if you attempt 
to put a cover layer over the Cell to capture mouse events.  As such, it 
is possible to only download the mouse code when such an attempt is 
made.  Otherwise, it simple keeps on going without the mouse code as it 
is not needed.

Because the load function does not return until AFTER the code has 
loaded and executed, it is possible to use the loaded objects on the 
very next line without missing a beat or using and loader / watch functions.

-- 
Michael Pemberton
[EMAIL PROTECTED]
ICQ: 12107010






_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[email protected]/

Reply via email to