register
[ Function ]
function register(
controlTypeName: string,
constructor: TcHmi.Controls.baseTcHmiControlConstructor,
directory: string,
templatePath?: string | null
): void;
Registers a control class in the system.
Before using a control, it must be made known to the system using this function.
From version 1.12 please use the function registerEx. |
Parameter
Name | Type | Description |
---|---|---|
controlTypeName | Name of the class. | |
constructor | Constructor | Constructor of the control. |
directory | Name of the control folder. | |
templatePath | Optional: Path of a template HTML file to be loaded into the control. |
Return value
Type | Description |
---|---|
void | No return value. |
Available from 1.8 |
Example - JavaScript 1
TcHmi.Controls.register('tchmi-mycontrol', Custom.mycontrol, 'Custom/mycontrol/');
Example - JavaScript 2
TcHmi.Controls.register('tchmi-mycontrol', Custom.mycontrol, 'Custom/mycontrol/', 'Custom/mycontrol/Template.html');