Skip to main content

opensocial.Collection

Method​

opensocial.Collection.getById​

Object getById(id)

Acquires entry using ID. If it does not exist, “null” is returned.

Parameter​
NameTypeDescription
idStringID
Return value​
TypeDescription
ObjectData
Sample​
var friends = res.get("friends").getData();
var friend = friends.getById("12345");

opensocial.Collection.size​

Number size()

Acquires collection sizes.

Parameter​

None

Return value​
TypeDescription
Number
Sample​
var friends = res.get("friends").getData();
var size = friends.size();

opensocial.Collection.each​

each(fn)

The specified functions are executed consecutively, with collection members as parameters.

Parameter​
名前TypeDescription
fnFunctionFunctions to be executed
Return value​

None

Sample​
var friends = res.get("friends").getData();
friends.each(function(friend) {
// ...
});

opensocial.Collection.asArray​

Array.<Object> asArray()

Acquires as object arrays.

Parameter​

None

Return value​
TypeDescription
Array.Object arrays
Sample​
var friends = res.get("friends").getData();
var array = friends.asArray();
for (var i=0; i<array.length; i++) {
// ...
}

opensocial.Collection.getTotalSize​

Number getTotalSize()

Acquires the size of the overall results the collection belongs to.

Parameter​

None

Return value​
TypeDescription
NumberTotal size of overall results
Sample​
var friends = res.get("friends").getData();
var totalSize = friends.getTotalSize();

opensocial.Collection.getOffset​

Number getOffset()

Acquires the offset in the overall results the collection belongs to.

Parameter​

None

Return value​
TypeDescription
NumberOffset
Sample​
var friends = res.get("friends").getData();
var offSet = friends.getOffset();

Revision History​

  • 12/2010
    • Initial Release.