# Class: oPreferences

## $. oPreferences

Provides access to getting/setting preferenes as an object interface.
All preferences that have been written to the file are accessible as properties of this class.
Alternatively, new preferences can be retrieved with the .get function.

#### new $.oPreferences()

openHarmony/openHarmony_preferences.js, line 64
  The constructor for the $.preferences class.

  ##### Example

      var pref = $.getPreferences();
      pref.create( "MyNewPreferenceName", "MyPreferenceValue" );
      pref["MyNewPreferenceName"];     // Provides: MyPreferenceValue
      pref.get("MyNewPreferenceName"); // Provides: MyPreferenceValue

### Members

#### create

  Creates a new preferences based on name and value.
  Note- A new preference isn't actively written into the Harmony's preference file until created and the application closed. Use preference.get for newly created preferences.

#### get

  Retrieves a preference and attempts to identify its type automatically.
  This is generally useful for accessing newly created preferences that have not been written to disk.

  ##### Example

      var pref = $.getPreferences();
      pref.create( "MyNewPreferenceName", "MyPreferenceValue" );
      //This new preference won't be available in the file until Harmony closes.
      //So if preferences are reinstantiated, it won't be readily available -- but it can still be retrieved with get.

      var pref2 = $.getPreferences();
      pref["MyNewPreferenceName"];     // Provides: undefined -- its not in the Harmony preference file.
      pref.get("MyNewPreferenceName"); // Provides: MyPreferenceValue, its still available

### Methods

#### refresh()

openHarmony/openHarmony_preferences.js, line 72
  Refreshes the preferences by re-reading the preference file and ingesting their values appropriately. They are then available as properties of this class.
  Note, any new preferences will not be available as properties until Harmony saves the preference file at exit. In order to reference new preferences, use the get function.