Update cookies preferences
Promotic

Preconfiguration "General asynchronous methods"

This preconfiguration can be activated when creating a new object (e.g. by "New object ..." in the context menu of the object or by pressing the Insert key after selecting the object) and is included in the group: "/ Technology".

- The preconfiguration creates an object of the PmaFolder type. The main object name is preconfigured to "Async".
- The preconfiguration is created including the panel (object of the PmaPanel type) is functional also as Web panel.


The preconfiguration allows to create and use user methods that will be executed asynchronously in the PmaSequencer object on the "Methods" tab. Here, the preconfiguration has created a template user method Example1.

In the PmaFolder object there are two system methods CallMethod and CallGetResult. These are used as interfaces for using designer's methods.
Parameters of the "CallMethod" method:
sMethod - user method name
aPars - the array of parameters of the user method
vCallback - the way of returning the value
null - not required
callback function name - name of the function where the return value will be sent
0 - returned by calling the "CallGetResult" method


The created panel also has two methods of the same name and contains a button (PmgButton). In the button script, there is an example of how to asynchronously get the return value from the user method.

In the beginning of the script of the CallMethod method of the PmaFolder object the examples of calling the user method Example1 are in the comments.
These configurators can be set before the preconfiguration is created:
The name of created objectName of the object created in the Pma objects tree.
The maximum name length is 30 characters.
This is a system name, so it must contain only alphanumeric and must not contain any diacritics (i.e. national dependent characters), empty string, spaces and the first character must not be a number.
Default: "Async"
Example1:
The example of using the asynchronous method without return value in the application script.
JavaScriptSelect and copy to clipboard

pMe.Pm("Async").Methods.CallMethod("Example1", Pm.CreatePmArray().Array1("wait", 5000), null);
Example2:
The example of using an asynchronous method with a return value in the callback function.
JavaScriptSelect and copy to clipboard

function onReturn(ev)
{
Pm.Debug("result");
}
pMe.Pm("Async").Methods.CallMethod("Example1", Pm.CreatePmArray().Array1("wait", 5000), onReturn);
PROMOTIC 9.0.28 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.