opensocial.Collection
Method
opensocial.Collection.getById
Object getById(id)
Acquires entry using ID. If it does not exist, “null” is returned.
Parameter
| Name | Type | Description |
|---|---|---|
| id | String | ID |
Return value
| Type | Description |
|---|---|
| Object | Data |
Sample
var friends = res.get("friends").getData();
var friend = friends.getById("12345");
opensocial.Collection.size
Number size()
Acquires collection sizes.
Parameter
None
Return value
| Type | Description |
|---|---|
| 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
| 名前 | Type | Description |
|---|---|---|
| fn | Function | Functions 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
| Type | Description |
|---|---|
| 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
| Type | Description |
|---|---|
| Number | Total 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
| Type | Description |
|---|---|
| Number | Offset |
Sample
var friends = res.get("friends").getData();
var offSet = friends.getOffset();
Revision History
- 12/2010
- Initial Release.