Constructor
new InternalSetting(opts, value)
Creates a new InternalSetting
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
opts |
object |
Object containing properties to set. Properties
|
||||||||||||
value |
Object |
The value of the setting. Any object type is OK, but keep in mind that it will be serialized to JSON when saved to the DB. |
- Source:
Members
name :string
Name is the name of the setting. Setting names should be unique, to prevent confusion.
- Source:
value :Object
Value is the value of the setting, which can be any valid JavaScript object. Keep in mind that this object will be serialized to JSON for storage, and will be restored as a JSON data structure instead of as the original object. (That is, it won't have any functions.) It's up to the developer to manage the values of InternalSetting objects.
- Source:
Methods
(static) inflateFrom(data) → {InternalSetting}
This converts a generic hash/object into an InternalSetting object. this is useful when loading objects from JSON.
Parameters:
Name | Type | Description |
---|---|---|
data |
object |
An object you want to convert to an InternalSetting. This object should have the properties 'name' and 'value'. |
- Source:
Example
let data = { name: 'Homer', value: 'Simpson' };
let setting = InternalSetting.inflateFrom(data);
validate() → {boolean}
validate returns true or false, indicating whether this object contains complete and valid data. If it returns false, check the errors property for specific errors.
- Source: