Class Index

Classes


Class opensocial.Enum

Base interface for all enum objects. This class allows containers to use constants for fields that are usually have a common set of values. There are two main ways to use this class.

If your gadget just wants to display how much of a smoker someone is, it can simply use:

html = "This person smokes: " + person.getField('smoker').getValue();

This value field will be correctly set up by the container. This is a place where the container can even localize the value for the gadget so that it always shows the right thing.

If your gadget wants to have some logic around the smoker field it can use:

if (person.getField('smoker').getKey() != "NO") { //gadget logic here }

Note: The key may be null if the person's smoker field cannot be coerced into one of the standard enum types. The value, on the other hand, is never null.


Defined in: opensocial.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
 
The value of this enum.
 
Use this for logic within your gadget.
Class Detail
opensocial.Enum()
Method Detail
{String} getDisplayValue()
The value of this enum. This will be a user displayable string. If the container supports localization, the string will be localized.
Returns:
{String} The enum's value.

{String} getKey()
Use this for logic within your gadget. If they key is null then the value does not fit in the defined enums.
Returns:
{String} The enum's key. This should be one of the defined enums below.

Documentation generated by JsDoc Toolkit 2.0.2 on Wed Nov 12 2008 12:32:43 GMT-0800 (PST)