Opensocial.Collection (v0.9)

NeedsExamples

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.

Methods

opensocial.Collection.asArray

;Array.<Object> asArray()

Returns
TypeDescription |

Array.<Object>

The values in this collection

Description
Returns an array of all the objects in this collection.

opensocial.Collection.each

;each(fn)

Parameters
NameTypeDescription |

fn

Function

The function to call with each collection entry

Description
Executes the provided function once per member of the collection, with each member in turn as the parameter to the function.

opensocial.Collection.getById

;Object? getById(id)

Parameters
NameTypeDescription |

id

String

The ID to look for

Returns
TypeDescription |

Object?

The data

Description
Finds the entry with the given ID value, or returns null if none is found.

opensocial.Collection.getOffset

;Number getOffset()

Returns
TypeDescription |

Number

The offset into the total collection

Description
Gets the offset of this collection within a larger result set.

opensocial.Collection.getTotalSize

;Number getTotalSize()

Returns
TypeDescription |

Number

The total size of the result

Description
Gets the total size of the larger result set that this collection belongs to.

opensocial.Collection.size

;Number size()

Returns
TypeDescription |

Number

The size of this collection

Description
Gets the size of this collection, which is equal to or less than the total size of the result.

{{ JsApiAlphaList_(v0.9) }}