ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\UI\Implementation\Render\JavaScriptBinding Interface Reference

Provides methods to interface with javascript. More...

+ Inheritance diagram for ILIAS\UI\Implementation\Render\JavaScriptBinding:
+ Collaboration diagram for ILIAS\UI\Implementation\Render\JavaScriptBinding:

Public Member Functions

 createId ()
 Create a fresh unique id. More...
 
 addOnLoadCode (string $code)
 Add some JavaScript-statements to the on-load handler of the page. More...
 
 getOnLoadCodeAsync ()
 Get all the registered on-load javascript code for the async context, e.g. More...
 
 clearOnLoadCodeAsync ()
 Clears all JavaScript code currently registered for the async context. More...
 

Detailed Description

Provides methods to interface with javascript.

Definition at line 26 of file JavaScriptBinding.php.

Member Function Documentation

◆ addOnLoadCode()

ILIAS\UI\Implementation\Render\JavaScriptBinding::addOnLoadCode ( string  $code)

Add some JavaScript-statements to the on-load handler of the page.

Implemented in ILIAS\UI\Implementation\Render\ilJavaScriptBinding.

◆ clearOnLoadCodeAsync()

ILIAS\UI\Implementation\Render\JavaScriptBinding::clearOnLoadCodeAsync ( )

Clears all JavaScript code currently registered for the async context.

This is necessary because rendering can register JavaScript as a side effect, even when the rendered output is not required by the current async endpoint.

This is caused by ILIAS treating controllers as independent layers, meaning a controller cannot reliably determine what has been executed before it, while each layer may contribute parts of the page. This causes unnecessary rendering and JavaScript registration. This method prevents said JavaScript from leaking into the async response.

This is a reminder that we want proper routing inside ILIAS: https://docu.ilias.de/go/wiki/wpage_8780_1357

Implemented in ILIAS\UI\Implementation\Render\ilJavaScriptBinding, and LoggingJavaScriptBinding.

◆ createId()

ILIAS\UI\Implementation\Render\JavaScriptBinding::createId ( )

Create a fresh unique id.

This MUST return a new id on every call.

Implemented in ILIAS\UI\Implementation\Render\ilJavaScriptBinding, and LoggingJavaScriptBinding.

◆ getOnLoadCodeAsync()

ILIAS\UI\Implementation\Render\JavaScriptBinding::getOnLoadCodeAsync ( )

Get all the registered on-load javascript code for the async context, e.g.

return all code inside <script> tags

Implemented in ILIAS\UI\Implementation\Render\ilJavaScriptBinding, and LoggingJavaScriptBinding.


The documentation for this interface was generated from the following file: