javascriptlabjs

LABjs conditionally loading scripts


I would like to start incorporating LABjs into my project but I want to know if there is anyway to conditionally load scripts. For example, something like:

$LAB
   .script('framework.js').wait()
   .script(function(){
       if(es){
          return  'es.js';
       }else{
          return '';
       }
   })

I have not tried this but am sure it will not work. Is there a more elegant way of doing this?

Thanks


Solution

  • http://blog.getify.com/2010/02/simulated-chaining-in-javascript/

    the answer ain't pretty but it's here