Class PageContentManager is designed to connect skitov (js) and styles (css) in C# code.

working Principle

The main purpose of PageContentManager - formation of the list of resources that need to be connected to the current page. The connection is made through IPageContentConnector (which must be configured in unity).

There are two ways of connecting resources:

setup activation script

By analogy with Ohm ContextHelper‘and his methods ДобавитьСкрипт and ДобавитьСкриптВDocumentReady, PageContentManager‘and have the ability to customize the activation of the script. To this end, the method call to add the script has a flag onPageLoad the default false.

Thus, the analog method is ДобавитьСкриптВDocumentReady call AttachJavaScriptCode(script, true);

Example usage

PageContentManager.AttachJavaScriptCode("alert('Hello');", true); // Displays a message box when the page loads. 

Own method of connection of scripts and styles

To use your own method of connection resources, you must create a new class and inherit interface IPageContentConnector.