Template directive: onscript

This directive works similary as the @script()directive. The only major difference is that any script pulled by @onscript() directive will be pulled into the javascript's window.onload() method.
onscript
Example: Javascript Rex File (index.rex.js)
  #script:js1
    
    function hi(){
      console.log('hi')
    }
    
  #script;

  #script:js2
    
    hi();
    
  #script;
                  
Now, we can import our javascript codes into php templates using the division id.
  @script('index:js1') 
  @onscript('index:js2') 
                  
These above will resolve as
  <script>
    function hi(){
      console.log('hi')
    }
  </script>
  
  <script>
  window.onload = function() {
  
    hi();
    
  } 
  </script>
                  
From the sample above, we can easily see the difference between @script() and @onscript() template directives.