Last active
December 10, 2015 15:18
-
-
Save Hydrotoast/4452860 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GroupMining() { | |
this.member_ids = []; | |
this.semaphore = 0; | |
this.groupsCount = 1; | |
} | |
GroupMining.prototype = { | |
unlock: function() { | |
if (++(this.semaphore) === this.groupsCount) { | |
resultStr = this.member_ids.join(','); | |
console.log(resultStr); | |
} | |
return this.semaphore; | |
} | |
}; | |
FB.getLoginStatus(function(response) { | |
gm = new GroupMining(); | |
if (response.status != 'connected') | |
return; | |
// ACM's Group ID is 228954137162541 | |
// Repeat this call for every group whose members you wish to mine | |
FB.api('/228954137162541/members', function(result) { | |
for (var i = 0; i < result.data.length; i++) | |
gm.member_ids.push(result.data[i].id); | |
gm.unlock(); | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Needs a set data structure to prevent duplicate IDs from reappearing in multiple group queries.