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.

register 1:

From version 1.12 please use the function registerEx.

Parameter

Name

Type

Description

controlTypeName

string

Name of the class.

constructor

Constructor

Constructor of the control.

directory

string

Name of the control folder.

templatePath

string, null

Optional: Path of a template HTML file to be loaded into the control.

Return value

Type

Description

void

No return value.

register 2:

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');