src/preferences/PreferencesBase.js
function (id, type, initial, options) {
            options = options || {};
            if (this._knownPrefs.hasOwnProperty(id)) {
                throw new Error("Preference " + id + " was redefined");
            }
            var pref = this._knownPrefs[id] = new Preference({
                type: type,
                initial: initial,
                name: options.name,
                description: options.description,
                validator: options.validator,
                excludeFromHints: options.excludeFromHints,
                keys: options.keys,
                values: options.values,
                valueType: options.valueType
            });
            this.set(id, initial, {
                location: {
                    scope: "default"
                }
            });
            return pref;
        }
function (id, type, initial, options) {
            options = options || {};
            if (this._knownPrefs.hasOwnProperty(id)) {
                throw new Error("Preference " + id + " was redefined");
            }
            var pref = this._knownPrefs[id] = new Preference({
                type: type,
                initial: initial,
                name: options.name,
                description: options.description,
                validator: options.validator,
                excludeFromHints: options.excludeFromHints,
                keys: options.keys,
                values: options.values,
                valueType: options.valueType
            });
            this.set(id, initial, {
                location: {
                    scope: "default"
                }
            });
            return pref;
        }
function ( id , type , initial , options ) { options = options || { } ; if ( this . _knownPrefs . hasOwnProperty ( id ) ) { throw new Error ( "Preference " + id + " was redefined" ) ; } var pref = this . _knownPrefs [ id ] = new Preference ( { type : type , initial : initial , name : options . name , description : options . description , validator : options . validator , excludeFromHints : options . excludeFromHints , keys : options . keys , values : options . values , valueType : options . valueType } ) ; this . set ( id , initial , { location : { scope : "default" } } ) ; return pref ; }
Defines a new preference.

@param {string} id identifier of the preference. Generally a dotted name.
@param {string} type Data type for the preference (generally, string, boolean, number)
@param {Object} initial Default value for the preference
@param {?{name: string=, description: string=, validator: function=, excludeFromHints: boolean=, keys: object=, values: array=, valueType: string=}} options
Additional options for the pref.
- `options.name`               Name of the preference that can be used in the UI.
- `options.description`        A description of the preference.
- `options.validator`          A function to validate the value of a preference.
- `options.excludeFromHints`   True if you want to exclude a preference from code hints.
- `options.keys`               An object that will hold the child preferences in case the preference type is `object`
- `options.values`             An array of possible values of a preference. It will show up in code hints.
- `options.valueType`          In case the preference type is `array`, `valueType` should hold data type of its elements.
@return {Object} The preference object.
Defines a new preference .