Class opensocial.Collection
Collection of multiple objects with useful accessors.
May also represent subset of a larger collection
(for example, page 1 of 10)
and contain information about the larger collection.
Defined in: opensocial.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
|
asArray()
Returns an array of all the objects in this collection.
|
|
|
each(fn)
Executes the provided function once per member of the collection,
with each member in turn as the
parameter to the function.
|
|
|
getById(id)
Finds the entry with the given ID value, or returns null if none is found.
|
|
|
Gets the offset of this collection within a larger result set.
|
|
|
Gets the total size of the larger result set
that this collection belongs to.
|
|
|
size()
Gets the size of this collection,
which is equal to or less than the
total size of the result.
|
Method Detail
{Array.<Object>}
asArray()
Returns an array of all the objects in this collection.
- Returns:
- {Array.<Object>} The values in this collection
each(fn)
Executes the provided function once per member of the collection,
with each member in turn as the
parameter to the function.
- Parameters:
- {Function} fn
- The function to call with each collection entry
{Object?}
getById(id)
Finds the entry with the given ID value, or returns null if none is found.
- Parameters:
- {String} id
- The ID to look for
- Returns:
- {Object?} The data
{Number}
getOffset()
Gets the offset of this collection within a larger result set.
- Returns:
- {Number} The offset into the total collection
{Number}
getTotalSize()
Gets the total size of the larger result set
that this collection belongs to.
- Returns:
- {Number} The total size of the result
{Number}
size()
Gets the size of this collection,
which is equal to or less than the
total size of the result.
- Returns:
- {Number} The size of this collection