FUEL/0.1/API/Preferences

From MozillaWiki
< FUEL‎ | 0.1‎ | API
Jump to navigation Jump to search

(This is just so that we can plan out the structure of the preferences area.)

Notes:

  • Is name the best name for the Preferences branch?
  • The branch, events, and type properties of Preference should be lazy loaded
  • prefs.has() and prefs.get() should check the input string to see if the current branch is already defined (e.g. the branch is "foo.bar" - but the user provides "foo.bar.baz")
  • getValue/setValue need to exist since getting/setting non-existent preferences is too valuable an operation

PreferenceBranch( String )

Properties:

  • root is a String [readonly]
  • all is a Array<Preference> [readonly]
  • events is an Events

Methods:

  • has( String ) returns a Boolean
  • get( String ) returns a Preference
  • getValue( String, Object ) returns an Object
  • setValue( String, Object )
  • reset()

Preference( String, PreferenceBranch )

Properties:

  • name is a String [readonly]
  • type is a String [readonly]
  • value is an Object [read/write]
  • locked is a Boolean [read/write]
  • default is a Boolean [readonly]
  • branch is a PreferenceBranch
  • events is an Events

Methods:

  • reset()