function Setting(settingSpec, settings) {
    this._settings = settings;

    Object.keys(settingSpec).forEach(function(key) {
        this[key] = settingSpec[key];
    }, this);

    this.type = types.getType(this.type);
    if (this.type == null) {
        throw new Error('In ' + this.name +
            ': can\'t find type for: ' + JSON.stringify(settingSpec.type));
    }

    if (!this.name) {
        throw new Error('Setting.name == undefined. Ignoring.', this);
    }

    if (!this.defaultValue === undefined) {
        throw new Error('Setting.defaultValue == undefined', this);
    }

    if (this.onChange) {
        this.on('change', this.onChange.bind(this))
    }

    this.set(this.defaultValue);
}
function Setting(settingSpec, settings) {
    this._settings = settings;

    Object.keys(settingSpec).forEach(function(key) {
        this[key] = settingSpec[key];
    }, this);

    this.type = types.getType(this.type);
    if (this.type == null) {
        throw new Error('In ' + this.name +
            ': can\'t find type for: ' + JSON.stringify(settingSpec.type));
    }

    if (!this.name) {
        throw new Error('Setting.name == undefined. Ignoring.', this);
    }

    if (!this.defaultValue === undefined) {
        throw new Error('Setting.defaultValue == undefined', this);
    }

    if (this.onChange) {
        this.on('change', this.onChange.bind(this))
    }

    this.set(this.defaultValue);
}
function Setting ( settingSpec , settings ) { this . _settings = settings ; Object . keys ( settingSpec ) . forEach ( function ( key ) { this [ key ] = settingSpec [ key ] ; } , this ) ; this . type = types . getType ( this . type ) ; if ( this . type == null ) { throw new Error ( 'In ' + this . name + ': can\'t find type for: ' + JSON . stringify ( settingSpec . type ) ) ; } if ( ! this . name ) { throw new Error ( 'Setting.name == undefined. Ignoring.' , this ) ; } if ( ! this . defaultValue === undefined ) { throw new Error ( 'Setting.defaultValue == undefined' , this ) ; } if ( this . onChange ) { this . on ( 'change' , this . onChange . bind ( this ) ) } this . set ( this . defaultValue ) ; }
Create a new setting.
@param settingSpec An object literal that looks like this:
{
name: 'thing',
description: 'Thing is an example setting',
type: 'string',
defaultValue: 'something'
}
Create a new setting .