ConfigApi

Standardized API for generating a module’s config GUI

configApi.addText(initial, callback)

ParamTypeDescription
initialstring

text to initialize text area

callbackfunction

processes the text when config is written

Add text area to config GUI

configApi.addInput(initial, callback)

ParamTypeDescription
initialstring

text to initialize text input

callbackfunction

processes the text when config is written

Add text input to config GUI

configApi.addLabel(text)

ParamTypeDescription
textstring

Text of the label

Add text label to config GUI

configApi.addPlusArea(initial, callback, validate, info, limit)

ParamTypeDescription
initialarray

list of text items

callbackfunction

processes the list of text items and write to js.config appropriatly

validatefunction

calls validate with each individual list item

infostring

descriptive msg displayed when end user presses info button

limitinteger

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)