I current have the following which works well:
channel.bind('pusher:subscription_succeeded', function(members) {
members.each(set_status_online);
})
function set_status_online(member) {
var user_temp;
user_temp = findWallUser(member.info.uid);
if (user_temp) {
user_temp.status('online');
}
else {
console.log('user not found');
}
}
I am trying to update the first part to give me more control of the members.each. I want something like this:
channel.bind('pusher:subscription_succeeded', function(members) {
members.each {
set_status('online');
}
})
Is there a way I can do that with the array & .each? thanks
With arrays, use
$.eachlike this:Change your function to have the
indexas the first variable:Or if you don’t want to modify your function, you can do this with the
$.each: