Skip to content

Kitto.Web.Routing.Scripts

Registry for dynamic script and CSS injection. Modules register their required JS/CSS files in their initialization section. The page template engine queries this registry to emit the appropriate tags.

TKXScriptRegistry class

Singleton registry. Modules call RegisterScript/RegisterStylesheet in their initialization sections. The page template queries GetScriptTags to emit all registered resources as HTML tags.

pascal
constructor Create;

Creates the registry with an empty entry list.

pascal
destructor Destroy;

Frees the entry list.

pascal
class destructor DestroyClass;

Frees the singleton instance at unit finalization.

pascal
procedure RegisterScript(const APath: string;

Registers a JavaScript file (e.g. '/js/chart.umd.min.js').

pascal
procedure RegisterStylesheet(const APath: string);

Registers a CSS stylesheet (e.g. '/css/event-calendar.min.css').

pascal
function GetScriptTags(const AResPath: string): string;

Returns HTML tags for all registered scripts, using the given resource base path (e.g. '/myapp/res').

pascal
function GetStylesheetTags(const AResPath: string): string;

Returns HTML tags for all registered stylesheets, using the given resource base path.

Released under Apache License, Version 2.0.