-
Notifications
You must be signed in to change notification settings - Fork 94
Configuration Specs
The Configuration Spec is a dictionary which represents all settings that an object in Exhibit requires, taking the form:
{
"SETTING_NAME": { SETTING DEFINITION }
};
This dictionary alone should be enough for an object to configure itself with defaults, and also enough to load override settings from the DOM or a supplied JSON object.
"anIntSetting": { "type": "int", "defaultValue": 1 }
"aTextSetting": { "type": "text" }
"aBooleanSetting": { "type": "boolean", "defaultValue": true },
List fields take any of the types above (e.g., boolean
, text
, int
, etc) but also take a dimension field
"listOfThreeBools": { "type": "boolean", "defaultValue": true, "dimension": 3 },
This would attempt to parse the value as a comma-separated list. It will result in a 3-element array. If the comma-separated list contains more than three elements, only the first three will be used. If it contains less, the remaining will be filled with the defaultValue (or null if no defaultValue is specified).
If the dimension is an asterisks, it means the resulting list will be however long the comma-separated list is. If the value is the empty string, it will be an empty list.
"listOfNBools": { "type": "boolean", "defaultValue": true, "dimension": "*" },
Sometimes it may be useful to have a setting loaded from an attribute different than the setting name. The following will load the setting FOO from the attribute BAR:
"FOO": { "type": "text", "attributeName": "BAR" },