基本上,这是我想要做的事。
- Get all my likes (page likes)
- Get all my friends
- for each of my friends, get their likes
- for each of their likes, do something
现在,我这样做的方式是利用共同财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产或财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、财产、 我的发言就是这样:
var newArray = [];
FB.api( me/likes , function(response){
FB.api( me/friends , function(friends){
$(friends).each(function(){
FB.api(this.uid+ /likes , function(fr_likes){
$(fr_likes).each(function(){
//save this friend likes to newArray
newArray.push(this);
});
});
});
});
});
//call newArray outside FB scope doesn t work at first
console.log(newArray); //returns [] / empty
但是,如果我用黄色灯在一度之后打电话给新的阿雷,新阿雷拉则慢慢地用了联邦调查局的数据。
因此,我的问题是:
- Can I wait for all the FB.api calls to be complete before doing something outside FB scope?
- What is the best practice for doing something like that (recursive FB api calls)?
感谢答案