19 declare(strict_types=1);
33 protected array
$code = array();
45 return str_replace(
".",
"_", uniqid(self::PREFIX,
true));
53 $this->global_tpl->addOnLoadCode($code, 1);
54 $this->code[] =
$code;
62 if (!count($this->code)) {
65 $js_out =
'<script data-replace-marker="script">' . implode(
"\n", $this->code) .
'</script>';
addOnLoadCode(string $code)
Add some JavaScript-statements to the on-load handler of the page.
createId()
Create a fresh unique id.This MUST return a new id on every call.
array $code
Cache for all registered JS code.
Interface Observer Contains several chained tasks and infos about them.
Wraps global ilTemplate to provide JavaScriptBinding.
getOnLoadCodeAsync()
Get all the registered on-load javascript code for the async context, e.g.return all code inside <scr...
Provides methods to interface with javascript.
__construct(private \ILIAS\UICore\GlobalTemplate $global_tpl,)