original_string: public function js_init_code($jscode, $ondomready = false, array $module = null) {
          $jscode = trim($jscode, " ;\n"). ';';
  
          $uniqid = html_writer::random_id();
          $startjs = " M.util.js_pending('" . $uniqid . "');";
          $endjs = " M.util.js_complete('" . $uniqid . "');";
  
          if ($module) {
              $this->js_module($module);
              $modulename = $module['name'];
              $jscode = "$startjs Y.use('$modulename', function(Y) { $jscode $endjs });";
          }
  
          if ($ondomready) {
              $jscode = "$startjs Y.on('domready', function() { $jscode $endjs });";
          }
  
          $this->jsinitcode[] = $jscode;
      }
code: public function js_init_code($jscode, $ondomready = false, array $module = null) {
          $jscode = trim($jscode, " ;\n"). ';';
  
          $uniqid = html_writer::random_id();
          $startjs = " M.util.js_pending('" . $uniqid . "');";
          $endjs = " M.util.js_complete('" . $uniqid . "');";
  
          if ($module) {
              $this->js_module($module);
              $modulename = $module['name'];
              $jscode = "$startjs Y.use('$modulename', function(Y) { $jscode $endjs });";
          }
  
          if ($ondomready) {
              $jscode = "$startjs Y.on('domready', function() { $jscode $endjs });";
          }
  
          $this->jsinitcode[] = $jscode;
      }
code_tokens: public function js_init_code ( $ jscode , $ ondomready = false , array $ module = null ) { $ jscode = trim ( $ jscode , " ;\n" ) . ';' ; $ uniqid = html_writer :: random_id ( ) ; $ startjs = " M.util.js_pending('" . $ uniqid . "');" ; $ endjs = " M.util.js_complete('" . $ uniqid . "');" ; if ( $ module ) { $ this -> js_module ( $ module ) ; $ modulename = $ module [ 'name' ] ; $ jscode = "$startjs Y.use('$modulename', function(Y) { $jscode $endjs });" ; } if ( $ ondomready ) { $ jscode = "$startjs Y.on('domready', function() { $jscode $endjs });" ; } $ this -> jsinitcode [ ] = $ jscode ; }
docstring: Add short static javascript code fragment to page footer.
  This is intended primarily for loading of js modules and initialising page layout.
  Ideally the JS code fragment should be stored in plugin renderer so that themes
  may override it.
  
  @param string $jscode
  @param bool $ondomready wait for dom ready (helps with some IE problems when modifying DOM)
  @param array $module JS module specification array
docstring_tokens: Add short static javascript code fragment to page footer . This is intended primarily for loading of js modules and initialising page layout . Ideally the JS code fragment should be stored in plugin renderer so that themes may override it .