register
[ Funktion ]
function register(
controlTypeName: string,
constructor: TcHmi.Controls.baseTcHmiControlConstructor,
directory: string,
templatePath?: string | null
): void;
Registriert eine Controlklasse im System.
Vor der Nutzung eines Controls muss dieses dem System mit dieser Funktion bekannt gemacht werden.
![]() | Ab Version 1.12 bitte die Funktion registerEx verwenden. |
Parameter
Name | Typ | Beschreibung |
---|---|---|
controlTypeName | Name der Klasse. | |
constructor | Contructor | Konstruktor des Controls. |
directory | Name des Ordner des Controls. | |
templatePath | Optional: Pfad einer Template HTML Datei welches in das Control geladen werden. |
Rückgabewert
Typ | Beschreibung |
---|---|
void | Kein Rückgabewert. |
![]() | Verfügbar ab Version 1.8 |
Beispiel - JavaScript 1
TcHmi.Controls.register('tchmi-mycontrol', Custom.mycontrol, 'Custom/mycontrol/');
Beispiel - JavaScript 2
TcHmi.Controls.register('tchmi-mycontrol', Custom.mycontrol, 'Custom/mycontrol/', 'Custom/mycontrol/Template.html');