Except as otherwise noted,
the content of this page is licensed under the Creative Commons
Attribution 2.5 License.
Provides access to user preferences, module dimensions, and messages. Clients can access their preferences by constructing an instance of gadgets.Prefs and passing in their module id. Example:
var prefs = new gadgets.Prefs();
var name = prefs.getString("name");
var lang = prefs.getLang();
gadgets.Prefs(opt_moduleId)
Array.<String>
getArray(key)
Boolean
getBool(key)
String
getCountry()
Number
getFloat(key)
Number
getInt(key)
String
getLang()
String, Number
getModuleId()
String
getMsg(key)
String
getMsgFormatted(key, opt_subst)
String
getString(key)
set(key, val)
setArray(key, val)
gadgets.Prefs(opt_moduleId)
String, Number opt_moduleId - An optional parameter specifying the
module id to create prefs for; if not provided, the default module id
is used
Array.<String> getArray(key)
String key - The preference to fetch
Array.<String> The preference; if not set, an empty array
Boolean getBool(key)
String key - The preference to fetch
Boolean The preference; if not set, false
String getCountry()
String The country for this module instance
Number getFloat(key)
String key - The preference to fetch
Number The preference; if not set, 0
Number getInt(key)
String key - The preference to fetch
Number The preference; if not set, 0
String getLang()
String The language for this module instance
String, Number getModuleId()
String, Number The module id for this module instance
String getMsg(key)
String key - The message to fetch
String The message
String getMsgFormatted(key, opt_subst)
String key - The message to fetch
String opt_subst - An optional string to substitute into the message
String The formatted string
String getString(key)
String key - The preference to fetch
String The preference; if not set, an empty string
set(key, val)
Note: If the gadget needs to store an Array it should use setArray instead of this call.
String key - The pref to store
Object val - The values to store
setArray(key, val)
String key - The pref to store
Array val - The values to store