JavaScript is an object oriented scripting language. Its syntax belongs to the C/C++/Java famiy. However there is no connection with the Java language (except for the similar syntax).
This scripting language is used in the PROMOTIC system in the following components:
- Design of WEB panels, that are to be functional in different browsers than the MS Internet Explorer (i.e. in Firefox, Chrome ..). In fact, you can write JavasSript scripts in the graphic item events (e.g. in the PmiButton.onButtonUp event). Before that, you have to set the "Scripting language settings" configurator in the corresponding PmPanel to "javascript".
- In the PmiCanvas graphic item, in the drawing event onDraw, the drawing algorithms are always written in JavaScript language regardless if the corresponding PmPanel object is set in the "Scripting language settings" configurator to "vbscript (obsolete)" or "javascript".
- In the data binding E - Binding to the general expression the JavaScript expression configurator is always entered in JavaScript expression syntax.
JavaScript is a high level language that supports many constructions valued by programmers (a set of own functions and methods, dynamic objects, first-class functions, prototyping, regular expressions, inheritance etc.). Although the PROMOTIC application designer is not forced to use these higher functions (it is even not recommended to use them) because only the basic knowledge of the language syntax is needed for application design (see JavaScript statements, The JavaScript operators, Data types JavaScript). This way the language becomes very simple to use, even simpler than the VBScript language - see Comparison of the VBScript and JavaScript languages.
The PROMOTIC system does not even use the embedded objects of the JavaScript language and replaces them by its own objects. The JavaScript objects are listed below:
- String: This JavaScript object has many methods for working with text strings. But the PROMOTIC uses the String data type, which is a primary data type, not an object. For working with this type the Pm string methods can, for example, be used.
- Number: This JavaScript object represents all numeric values (Byte, Integer, Long, Single, Double). But the PROMOTIC system uses the basic data types instead.
- Boolean: This JavaScript object represents Boolean value and the PROMOTIC system uses the basic data type instead.
- Date: This JavaScript object has many methods for working with date and time. The PROMOTIC system stores date and time as basic Date type (it is a VBScript language data type).

The method Pm.CreatePmDateObject can be used to transform the values of the Date type into a PmDateObject object. this object has its own methods for working with date and time (read and write hour, day, month, etc.).

See also: Pm date and time methods.

- Array: This JavaScript object represents 1-dimensional value array. The PROMOTIC system uses the Array data type instead, that corresponds to the JavaScript language PmArray object. In contrast to the JavaScript object, the PmArray object can be 1-dimensional or 2-dimensional and all the features of this object are adapted to the needs of the PROMOTIC system. See How to use array of values in the PROMOTIC system.
- Math: This JavaScript object represents a library of mthematic methods. The PROMOTIC system has its own mathematic methods, see Pm properties and methods mathematic and others.
- Object: This JavaScript object represents the basic object. The PROMOTIC system does not need such object.
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice