Quang Nguyen wrote:
> I am going to sound really a beginer, but what does "async mode" and
> "To get scripts loaded in the same scope as the window
> object" mean? What is the advantage of having the function run in
> async mode or not?
Async is to do with how it handles the process of loading. Take the following code for
example:
{
some code
some more code
even more code
a "load call" <!--- this is the one
just a few more lines of code
almost there
the last line
}
Here's how the code would finish executing in "sync" mode:
{
1 some code
2 some more code
3 even more code
4 a "load call" <!--- this is the one
5 just a few more lines of code
6 almost there
7 the last line
}
If the loading takes too long, "async" may look like this:
{
1 some code
2 some more code
3 even more code
7 a "load call" <!--- this is the one
4 just a few more lines of code
5 almost there
6 the last line
}
This is because in "async" mode, the load function returns instantly even if it is
still loading. For this treason, it is possible to continue executing the rest of the
code WHILE the load function is running. If we are using it to load code the is
required further down, it is important to make sure it is loaded before we continue,
this is where "sync" mode is used. This requires that the load function is finished
before it returns and we continue with the rest of our code.
I hope this makes sense and helps a little. :)
--
Michael Pemberton
[EMAIL PROTECTED]
ICQ: 12107010
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[email protected]/