Module

RMP_Scripter


new RMP_Scripter(conf)

This constructor allows you to create a JavaScript widget that can be inserted dynamically in your web interface.

Parameters:
Name Type Description
conf Object JSON structure which contains the configuration of the JavaScript widget
Example
var conf = {
     "id":"id_scripter",
     "label":"My scripter",
     "variable":[{"name":"my_scripter"}],
     "js-type":"RMP_Scripter"
};

var scripter = new RMP_Scripter(conf);
id_of_a_widget.insertAfter(scripter);

id_scripter.setJsWidgetScript(()=> {
     // do whatever
     return "scripter executed"
})

Methods

# inner getErrorMessage() → {string}

Returns the error message of the Scripter widget.
string

# inner getType() → {string}

Returns the type of the widget (RMP_Scripter).
string

# inner setErrorMessage(errorMsg)

Sets the error message of the Scripter widget.
Parameters:
Name Type Description
errorMsg

# inner setJsWidgetScript(callBk, optionsopt)

handles Scripter widget
Parameters:
Name Type Attributes Description
callBk module:RMP_Section~callbackFunction Function to be executed and return Scripter widget value
options Object <optional>
executeEvenEmpty boolean Execute the callback function even when a listened to variable is empty
errorMessage string Message to be displayed when the callback function generates an error
listenedVariables Array.<Object> Array of variables to listen to, for example: [{ name: 'array.name', index: 0 }, {name : 'text'}].
listenedVariables[].name string Name of the variable
listenedVariables[].index number <optional>
Index of a variable (in case it is inside an array widget)
Example
id_scripter.setJsWidgetScript(
 () => 'Hello World!',
 {
     executeEvenEmpty : true,
     errorMessage : 'Error while processing Scripter widget',
     listenedVariables : [{name: 'txt'}]
 }
);

Type Definitions

# callbackFunction()

Callback function contains script executed by Scripter widget.