Awesome Christoff. Thanks for the help!
Rey
Christof Donat wrote:
> Hi,
>
>
>>which discusses Dynamic Script Pattern or On-Demand Javascript. I think
>>this is a VERY cool feature. Does Jquery support something like this?
>
>
> I wouldn't put it into jQuery itsself, because then you would need to load
> jQuery before you can use the dynamic Script loading. I have developed
> something like this which you can se at
http://jspax.cdonat.de . I am using
> it to load jQuery, jQuery Plugins and some other of my code.
>
>
>>What are the pros and cons of something like this?
>
>
> Pros:
> - don't need to load everything at startup of your page - faster startup
> - don't need to load all the code you don't need on the page:
> $('#myElement').click(function() {
> $using('jquery.fx',function() {
> $(this).slideUp('slow');
> });
> });
> The fx-Plugin is loaded after the first click on the Element and as soon as it
> is available the slideUp is executed.
> - you can easier modularize your code
> - the dynamic script loader can handle dependencies:
> $using('com.example.test',function() {...});
> Now com/example/test.js could contain
> $using('com.example.test2',function() {
> ...;
> $package('com.example.test',{});
> });
> the dependency is automatically resolved.
>
> Cons:
> - you can not be shure that your code was loaded and executed as usual while
> the page was loading - document.write() e.g. may behave differently.
> - either you need to do synchronous loading like JSON does or you need to work
> with callbacks as I do. Synchronous loading blocks the browser, callbacks are
> not understood by everyone.
> - to load all the scripts your page needs multiple HTTP-Requests are necessary
> which increases the overhead.
>
> I hope that helps.
>
> Christof
>
> _______________________________________________
> jQuery mailing list
>
discuss@...
>
http://jquery.com/discuss/>
_______________________________________________
jQuery mailing list
discuss@...
http://jquery.com/discuss/