Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
javascript
javascript
gadgets.ee.registerRootContextListener(function(rootContext) {
  var eeDataModel;
  if(rootContext.type === opensocial.type.ActivityEntry) {
    eeDataModel = rootContext.root.openSocial.embed;
  } else if(rootContext.type === opensocial.type.Message) {  
    //At the time this proposal was written EE was not integrated into the OpenSocial Message object
    eeDataModel = rootContext.root.embed;
  } else if(rootContext.type === opensocial.type.SearchResult) {  
    //At the time this proposal was written there is no SearchResult object in the OpenSocial spec
    eeDataModel = rootContext.root.embed;
  } else {
    gadgets.error('Unknown type');
  }
});

<static> gadgets.ee.getEmbeddedExperiencesDataModel(rootContext)

Description: Given an embedded experiences root context object it will return the embedded experiences data model.

Returns: An embedded experiences data model.

Parameters:

Name

Type

Description

rootContext

opensocial.ee.RootContext

The embedded experiences root context object, ie an activity entry, message, etc, to get the embedded experiences data model from.

Example:

Code Block
javascript
javascript

gadgets.ee.getEmbeddedExperiencesDataModel(function(rootContext) {
  var eeDataModel = getEmbeddedExperiencesDataModel(rootContext);
  if(!eeDataModel) {
    gadgets.error('No data model');
    return;
  }
  //Do something with the data model
});

Embedded Experiences Root Context Object

...