Gadgets.Prefs (v0.9)

Gadgets.Prefs (v0.9)

NeedsExamples

gadgets.Prefs

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();

Methods

gadgets.Prefs.getArray

;Array.<String> getArray(key)

Parameters
NameTypeDescription |

Returns
TypeDescription |

Description
Retrieves a preference as an array. UserPref values that were not declared as lists are treated as one-element arrays.

gadgets.Prefs.getBool

;Boolean getBool(key)

Parameters
NameTypeDescription |

Returns
TypeDescription |

Description
Retrieves a preference as a boolean.

gadgets.Prefs.getCountry

;String getCountry()

Returns
TypeDescription |

Description
Gets the current country, returned as ISO 3166-1 alpha-2 code.

gadgets.Prefs.getFloat

;Number getFloat(key)

Parameters
NameTypeDescription |

Returns
TypeDescription |

Description
Retrieves a preference as a floating-point value.

gadgets.Prefs.getInt

;Number getInt(key)

Parameters
NameTypeDescription |

Returns
TypeDescription |

Description
Retrieves a preference as an integer.

gadgets.Prefs.getLang

;String getLang()

Returns
TypeDescription |

Description
Gets the current language the gadget should use when rendering, returned as a ISO 639-1 language code.

gadgets.Prefs.getModuleId

;String | Number getModuleId()