code: function Preference(key, defaultValue, allowedValues, namespace ) {
  
      this.preferences = storage.localNamespace(namespace || DEFAULT_NS_NAME);
      if (key === undefined) {
          throw new Error('Cannot create preference. Preference "key" name must be specified.');
      }
      this.key = key;
      let value = this.preferences.get(key);
      if (!value && defaultValue) {
          this.preferences.set(key, defaultValue);
          value = defaultValue;
      }
      this.value = value;
      this.allowedValues = allowedValues;
  }
docs: This uses the localStorage to store and read from. We use a simple
  key:value in the localStorage but further expose the allowedValues
  passed. For now we do not validate those.
  @param {string} key - the key we want to store
  @param {string} [defaultValue] - if no value is set in the storage we will set this value
  @param {Array} [allowedValues] - an array of known values that should be supported
  @param {string} [namespace] - if no value we use default namespace
  @constructor
  @example
  preference.newPreference('key', ['defaultValue', 'allowedValues', 'namespace']);