Difference between revisions of "Opensocial.Environment (v0.8)"

From VZ Developer Wiki
Jump to: navigation, search
(Die Seite wurde neu angelegt: „<div style="float:right; margin: 0 0 10px 10px;">__TOC__</div> <span style="font-size:150%">'''opensocial.Environment '''</span> Base interface for all environme…“)
(No difference)

Revision as of 11:18, 14 September 2009

opensocial.Environment

Base interface for all environment objects.

Methods

opensocial.Environment.getDomain

opensocial.Environment.getDomain()
Parameters
None
Returns
String - The domain

Examples

function alertDomain() {
  var env = opensocial.getEnvironment();
  var domain = env.getDomain();
  var text = "The current domain is " + domain;
  alert(text);
}

opensocial.Environment.supportsField

Boolean opensocial.Environment.supportsField(objectType, fieldName)
Parameters
opensocial.Environment.ObjectType objectType - The object type to check for the field
String fieldName - The name of the field to check for
Returns
Boolean - True if the field is supported on the specified object type

Examples

function alertSupportsField() {
  var env = opensocial.getEnvironment();
  var supportsEmail = env.supportsField(
      opensocial.Person.Field.EMAIL,
      opensocial.Environment.ObjectType.EMAIL);

  var text = ['This container does',
              supportsEmail ? ' ' : ' NOT ',
              'support the email field',].join('');
  alert(text);
}

Fields

opensocial.Environment.ObjectType

opensocial.Environment.ObjectType.PERSON

This field may be used interchangeably with the string 'person'.

opensocial.Environment.ObjectType.ADDRESS

This field may be used interchangeably with the string 'address'.

opensocial.Environment.ObjectType.BODY_TYPE

This field may be used interchangeably with the string 'bodyType'.

opensocial.Environment.ObjectType.EMAIL

This field may be used interchangeably with the string 'email'.

opensocial.Environment.ObjectType.NAME

This field may be used interchangeably with the string 'name'.

opensocial.Environment.ObjectType.ORGANIZATION

This field may be used interchangeably with the string 'organization'.

opensocial.Environment.ObjectType.PHONE

This field may be used interchangeably with the string 'phone'.

opensocial.Environment.ObjectType.URL

This field may be used interchangeably with the string 'url'.

opensocial.Environment.ObjectType.ACTIVITY

This field may be used interchangeably with the string 'activity'.

opensocial.Environment.ObjectType.MEDIA_ITEM

This field may be used interchangeably with the string 'mediaItem'.

opensocial.Environment.ObjectType.MESSAGE

This field may be used interchangeably with the string 'message'.

opensocial.Environment.ObjectType.MESSAGE_TYPE

This field may be used interchangeably with the string 'messageType'.

opensocial.Environment.ObjectType.SORT_ORDER

This field may be used interchangeably with the string 'sortOrder'.

opensocial.Environment.ObjectType.FILTER_TYPE

This field may be used interchangeably with the string 'filterType'.



We are implementing the following APIs from the OpenSocial 0.8 spec

gadgets.flash

gadgets.io

gadgets.json

gadgets.MiniMessage

gadgets.Prefs

gadgets.pubsub

gadgets.rpc

gadgets.skins

gadgets.Tab


gadgets.TabSet

gadgets.util

gadgets.views

gadgets.window

opensocial

opensocial.Activity

opensocial.Address

opensocial.BodyType

opensocial.Collection

opensocial.CreateActivityPriority

opensocial.DataRequest

opensocial.DataResponse

opensocial.Email

opensocial.Enum

opensocial.Environment

opensocial.EscapeType

opensocial.IdSpec

opensocial.MediaItem

opensocial.Message

opensocial.Name

opensocial.NavigationParameters

opensocial.Organization

opensocial.Permission

opensocial.Person

opensocial.Phone

opensocial.ResponseItem

opensocial.Url