function preferencesSet(name, value) {
    return this.initializedPromise.then(function () {
      if (DEFAULT_PREFERENCES[name] === undefined) {
        throw new Error('preferencesSet: \'' + name + '\' is undefined.');
      } else if (value === undefined) {
        throw new Error('preferencesSet: no value is specified.');
      }
      var valueType = typeof value;
      var defaultType = typeof DEFAULT_PREFERENCES[name];

      if (valueType !== defaultType) {
        if (valueType === 'number' && defaultType === 'string') {
          value = value.toString();
        } else {
          throw new Error('Preferences_set: \'' + value + '\' is a \"' +
                          valueType + '\", expected \"' + defaultType + '\".');
        }
      } else {
        if (valueType === 'number' && (value | 0) !== value) {
          throw new Error('Preferences_set: \'' + value +
                          '\' must be an \"integer\".');
        }
      }
      this.prefs[name] = value;
      return this._writeToStorage(this.prefs);
    }.bind(this));
  }
/**
   * Set the value of a preference.
   * @param {string} name The name of the preference that should be changed.
   * @param {boolean|number|string} value The new value of the preference.
   * @return {Promise} A promise that is resolved when the value has been set,
   *                   provided that the preference exists and the types match.
   */
Set the value of a preference.
@param {string} name The name of the preference that should be changed.
@param {boolean|number|string} value The new value of the preference.
@return {Promise} A promise that is resolved when the value has been set,
provided that the preference exists and the types match.
Set the value of a preference . @param { string } name The name of the preference that should be changed . @param { boolean|number|string } value The new value of the preference . @return { Promise } A promise that is resolved when the value has been set provided that the preference exists and the types match .
function preferencesSet(name, value) {
    return this.initializedPromise.then(function () {
      if (DEFAULT_PREFERENCES[name] === undefined) {
        throw new Error('preferencesSet: \'' + name + '\' is undefined.');
      } else if (value === undefined) {
        throw new Error('preferencesSet: no value is specified.');
      }
      var valueType = typeof value;
      var defaultType = typeof DEFAULT_PREFERENCES[name];
      if (valueType !== defaultType) {
        if (valueType === 'number' && defaultType === 'string') {
          value = value.toString();
        } else {
          throw new Error('Preferences_set: \'' + value + '\' is a \"' +
                          valueType + '\", expected \"' + defaultType + '\".');
        }
      } else {
        if (valueType === 'number' && (value | 0) !== value) {
          throw new Error('Preferences_set: \'' + value +
                          '\' must be an \"integer\".');
        }
      }
      this.prefs[name] = value;
      return this._writeToStorage(this.prefs);
    }.bind(this));
  }
function preferencesSet ( name , value ) { return this . initializedPromise . then ( function ( ) { if ( DEFAULT_PREFERENCES [ name ] === undefined ) { throw new Error ( 'preferencesSet: \'' + name + '\' is undefined.' ) ; } else if ( value === undefined ) { throw new Error ( 'preferencesSet: no value is specified.' ) ; } var valueType = typeof value ; var defaultType = typeof DEFAULT_PREFERENCES [ name ] ; if ( valueType !== defaultType ) { if ( valueType === 'number' && defaultType === 'string' ) { value = value . toString ( ) ; } else { throw new Error ( 'Preferences_set: \'' + value + '\' is a \"' + valueType + '\", expected \"' + defaultType + '\".' ) ; } } else { if ( valueType === 'number' && ( value | 0 ) !== value ) { throw new Error ( 'Preferences_set: \'' + value + '\' must be an \"integer\".' ) ; } } this . prefs [ name ] = value ; return this . _writeToStorage ( this . prefs ) ; } . bind ( this ) ) ; }
Set the value of a preference.
Set the value of a preference .