ConfigApi¶
Standardized API for generating a module’s config GUI
configApi.addText(initial, callback)¶
| Param | Type | Description |
|---|---|---|
| initial | string | text to initialize text area |
| callback | function | processes the text when config is written |
Add text area to config GUI
configApi.addInput(initial, callback)¶
| Param | Type | Description |
|---|---|---|
| initial | string | text to initialize text input |
| callback | function | processes the text when config is written |
Add text input to config GUI
configApi.addLabel(text)¶
| Param | Type | Description |
|---|---|---|
| text | string | Text of the label |
Add text label to config GUI
configApi.addPlusArea(initial, callback, validate, info, limit)¶
| Param | Type | Description |
|---|---|---|
| initial | array | list of text items |
| callback | function | processes the list of text items and write to js.config appropriatly |
| validate | function | calls validate with each individual list item |
| info | string | descriptive msg displayed when end user presses info button |
| limit | integer | maximum number of items which can be added to the list |
Usage example
// Add plus area
var params = {
"initial":js.config.field_name.map((tok)=>{JSON.stringify(tok)}),
"validate":function(val){return val.hasOwnProperty('answer')},
"callback":function(val){js.config.field_name = JSON.parse(val)},
"info":"<h3>Instructions</h3>",
"limit":2,
}
js.ConfigApi.addPlusArea(params)