Skip to content

Instantly share code, notes, and snippets.

@davehunt
Created September 29, 2011 22:26
Show Gist options
  • Save davehunt/1252110 to your computer and use it in GitHub Desktop.
Save davehunt/1252110 to your computer and use it in GitHub Desktop.
// PREFS.JS
/**
* Retrieve the value of the homepage preference
*
* @memberOf prefs
* @param {Boolean|Number|String|Object} [aDefaultValue]
* Default value which will be used if the preference doesn't exist.
* @param {PrefBranch} [aBranch]
* Preferences branch to use.
*
* @returns {Boolean|Number|String|Object} The value of the preference
*/
function getHomepagePref(aDefaultValue, aBranch) {
return getPref(Ci.nsIPrefLocalizedString, "browser.startup.homepage",
aDefaultValue, aBranch);
}
// TEST.JS
var prefs = require("../../../lib/prefs");
...
prefs.getHomepagePref(undefined, prefs.defaultBranch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment