how would jsPax accomplish:

$("user").each(function(){
    $.jsanUse('com.myapp.userClass');
    com.myapp.userClass.doSomething(this);
});

Where com.myapp.userClass.doSomething is passed the selected user?

Would it have to be this?
$using('com.myapp.userClass', function() {
    $("user").each(function(){
        com.myapp.userClass.doSomething(this);
    });
});

If so then com.myapp.userClass is loaded regardless if it is needed or
not.  That is something I would like to avoid.

Overall I think we both agree that namespace based on-demand package
loading is a valuable asset to any JS developer.  The finer details of
exactly how that should be implemented is the only bit at issue here.

-wade

p.s. I just want to reiterate that JSAN can be used without jQuery,
but if it is used as a plugin you can take advantage of built in
jQuery methods instead of replicating them in a standalone way.  If an
app is going to make extensive use of jQuery anyway I see no fault in
loading jQuery and the small plugin.  Otherwise one could use the
standalone.  Also, I specifically introduced the altURLs to support
YUI which does not match filenames to namespaces, this did not add
that much overhead (5 short lines of code).

Reply via email to