To open: use app.UI.modal(title, type, data, options);
which contains the first parameter title
as the message at the top of the box STRING typed ""
& the second parameter type
will determine their content type, each with different options defined below and the third parameter data
as an JSON {}
which contains attributes as so
/* For response type: alert */
text: "Action button name"
link: "URL redirection"
jsaction: JS_function_to_call
/* For response type: confirm (selectable) */
options: {
"opt1": {"link": "URL redirection"},
"opt2": {"jsaction": JS_function_to_call}
}
/* For response type: confirm (answer) */
choices: [
["opt1", "ans1"],
["opt2", 2],
["opt3", 3.0]
]
to: JS_function_recieving_response
/* For response type: prompt */
input: "input element type attribute value" /* ["text", "password", "number", "tel", "email", "url", "date", "time", "color", etc...] */
to: JS_function_recieving_response
placeholder: "Filling example" /* (Optional) */
vaidation: { /* According to each type of input inherited from HTML element (Optional) */
"pattern": "regex",
"min": 0, "max": 5, "step": 2
"size": 3,
"maxlength": 10
}
prefill: "value" /* (Optional) */
For any initiation with JS_function_* in attribute value(s): JS_function_*
is a function called after the options are chosed or response send and must contain only 1 parameter for the responded value or the selected option. And last parameter options
(optional) as an JSON {}
which define the behavior of the modal as described below
position: "top"|"bottom" /* Defaults to bottom */
importance: 0-4 /* Defaults to 0 */
/* Deprecated */
dismissable: true|false /* Defaults to true */
To close: Normally, after an interaction, a programmatically close is not required for the modal will automatically close itself, but if it was so, then use app.UI.modal.close();
To get status: use app.UI.modal.isOpen();