メインコンテンツまでスキップ

opensocial.Collection


メソッド​

opensocial.Collection.getById​

Object getById(id)

エントリーをIDで取得します。存在しない場合にはnullが返ります。

パラメータ​
名前型説明
idStringID
返り値​
型説明
Objectデータ
サンプル​
var friends = res.get("friends").getData();
var friend = friends.getById("12345");

opensocial.Collection.size​

Number size()

コレクションのサイズを取得します

パラメータ​

なし

返り値​
型説明
Number
サンプル​
var friends = res.get("friends").getData();
var size = friends.size();

opensocial.Collection.each​

each(fn)

指定された関数を、コレクションのメンバーをパラメータとして1回ずつ実行します。

パラメータ​
名前型説明
fnFunction実行する関数
返り値​

なし

サンプル​
var friends = res.get("friends").getData();
friends.each(function(friend) {
// ...
});

opensocial.Collection.asArray​

Array.<Object> asArray()

オブジェクトの配列として取得します。

パラメータ​

なし

返り値​
型説明
Array.オブジェクトの配列
サンプル​
var friends = res.get("friends").getData();
var array = friends.asArray();
for (var i=0; i<array.length; i++) {
// ...
}

opensocial.Collection.getTotalSize​

Number getTotalSize()

このコレクションが属する結果全体のサイズを取得します。

パラメータ​

なし

返り値​
型説明
Number結果全体の総サイズ
サンプル​
var friends = res.get("friends").getData();
var totalSize = friends.getTotalSize();

opensocial.Collection.getOffset​

Number getOffset()

このコレクションが属する結果全体の中のオフセットを取得します。

パラメータ​

なし

返り値​
型説明
Numberオフセット
サンプル​
var friends = res.get("friends").getData();
var offSet = friends.getOffset();

更新履歴​

  • 2013/03/15
    • ドキュメント移行