Hi, > > I've looked at your package.js, and I've found that you use the > > setTimeout method for evaluating the loaded script in the global scope, > > with a delay of 1 millisecond. Don't you have any problems with that?
No, I have not experienced any problems with that up to now. I guess, that it might lead to noticable delays if you include very many scripts. In that case the HTTP-overhead will create even more delay. Since there is another setTimeout() with 10ms in $package.require() to check if the package-Object has been created later, there may be an even longer delay here. > I think it is good to keep this in mind when working with setTimeout. Yes, of course. setTimeout() never gave exact times and you can only be shure that it waits roughly at least as long as you tell it to do. As I said, with usual Network-connections the HTTP-Overhead and the other timeout will lead to noticable delays first before you will notice the delays of that timeout. If your application loads so many scripts that there is a noticabple delay, you will be best off to put multiple packages into a single script and only load that one: --- mylib.js // create a basic package $package('mylib.first', { test: function() { window.alert('test'); } }); // Tell the system that it should not load a script for that package. $package('$package.mylib.first.loaded',true); // this callback will be called immediatelly, because the package already // exists $using('mylib.first', function() { // create another package $package('mylib.second', { test: mylib.first.test; }); // Tell the system that it should not load a script for that package. $package('$package.mylib.second.loaded',true); }); // create the scripts main package $package('mylib',{}); --- --- main.js $using('mylib', function() { // yes we can use all packages here. mylib.second.test(); }); --- Christof _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/