
from js.core.Profiler import *
import logging

class Loader():
    def __init__(self, classList):
        self.__classList = classList

        
    def generate(self, fileName=None, bootCode=None):
        result = ["$LAB"]
        
        pstart()
        logging.info("Generating loader...")
        
        for classObj in self.__classList:
            if classObj == "WAIT":
                result.append("wait()")
                
            else:
                result.append('script("%s")' % classObj.path)
                
        if bootCode:
            result.append("wait(function(){%s})" % bootCode)
            
        result = "\n.".join(result)
        pstop()
        
        if fileName:
            output = open(fileName, mode="w", encoding="utf-8")
            output.write(result)
            output.close()
            
        else:
            return result



from js.core.Profiler import *
import logging

class Loader():
    def __init__(self, classList):
        self.__classList = classList

        
    def generate(self, fileName=None, bootCode=None):
        result = ["$LAB"]
        
        pstart()
        logging.info("Generating loader...")
        
        scripts = []
        for classObj in self.__classList:
            if classObj == "WAIT":
                result.append('script(["%s"]).wait()' % '","'.join(scripts))
                scripts = []
                
            else:
                scripts.append(classObj.path)
                
        if bootCode:
            result.append("wait(function(){%s})" % bootCode)
            
        result = "\n.".join(result)
        pstop()
        
        if fileName:
            output = open(fileName, mode="w", encoding="utf-8")
            output.write(result)
            output.close()
            
        else:
            return result


Make use of array support in script() of LABjs to fix recursion errors
Make use of array support in script() of LABjs to fix recursion errors

  
  from js.core.Profiler import *
  import logging
  
  class Loader():
      def __init__(self, classList):
          self.__classList = classList
  
          
      def generate(self, fileName=None, bootCode=None):
          result = ["$LAB"]
          
          pstart()
          logging.info("Generating loader...")
          
+         scripts = []
          for classObj in self.__classList:
              if classObj == "WAIT":
-                 result.append("wait()")
+                 result.append('script(["%s"]).wait()' % '","'.join(scripts))
+                 scripts = []
                  
              else:
-                 result.append('script("%s")' % classObj.path)
+                 scripts.append(classObj.path)
                  
          if bootCode:
              result.append("wait(function(){%s})" % bootCode)
              
          result = "\n.".join(result)
          pstop()
          
          if fileName:
              output = open(fileName, mode="w", encoding="utf-8")
              output.write(result)
              output.close()
              
          else:
              return result
  
  
Make use of array support in script() of LABjs to fix recursion errors
## Code Before:

from js.core.Profiler import *
import logging

class Loader():
    def __init__(self, classList):
        self.__classList = classList

        
    def generate(self, fileName=None, bootCode=None):
        result = ["$LAB"]
        
        pstart()
        logging.info("Generating loader...")
        
        for classObj in self.__classList:
            if classObj == "WAIT":
                result.append("wait()")
                
            else:
                result.append('script("%s")' % classObj.path)
                
        if bootCode:
            result.append("wait(function(){%s})" % bootCode)
            
        result = "\n.".join(result)
        pstop()
        
        if fileName:
            output = open(fileName, mode="w", encoding="utf-8")
            output.write(result)
            output.close()
            
        else:
            return result


## Instruction:
Make use of array support in script() of LABjs to fix recursion errors
## Code After:

from js.core.Profiler import *
import logging

class Loader():
    def __init__(self, classList):
        self.__classList = classList

        
    def generate(self, fileName=None, bootCode=None):
        result = ["$LAB"]
        
        pstart()
        logging.info("Generating loader...")
        
        scripts = []
        for classObj in self.__classList:
            if classObj == "WAIT":
                result.append('script(["%s"]).wait()' % '","'.join(scripts))
                scripts = []
                
            else:
                scripts.append(classObj.path)
                
        if bootCode:
            result.append("wait(function(){%s})" % bootCode)
            
        result = "\n.".join(result)
        pstop()
        
        if fileName:
            output = open(fileName, mode="w", encoding="utf-8")
            output.write(result)
            output.close()
            
        else:
            return result

