|
/* FACEBOOK EVENTS BEST PRACTICES |
|
=========================== |
|
1. For most cases, you will want to subscribe to auth.authResponseChange rather than auth.statusChange. |
|
The response is returned as a javascript array, not encoded as JSON. |
|
|
|
2. Note that for some cases, the value of response is unkeyed, but when more than one variable is returned, it contains the appropriate keys. |
|
|
|
3. You can subscribe multiple callbacks to one event using different function names. |
|
=========================== */ |
|
|
|
FB.Event.subscribe('auth.login', function(response) { |
|
// fired when the auth status changes to connected |
|
console.log("Facebook EVENT auth.login", response); |
|
}); |
|
|
|
FB.Event.subscribe('auth.authResponseChange', function(response) { |
|
// fired when the authResponse changes |
|
console.log("Facebook EVENT auth.authResponseChange", response); |
|
handleAuthResponse(response); |
|
}); |
|
|
|
FB.Event.subscribe('auth.statusChange', function(response) { |
|
// fired when the status changes (see FB.getLoginStatus for additional information on what this means) |
|
// NOTE: auth.statusChange() does not have a 'status' field. |
|
console.log("Facebook EVENT auth.statusChange", response); |
|
}); |
|
|
|
FB.Event.subscribe('auth.logout', function(response) { |
|
// fired when the user logs out. |
|
console.log("Facebook EVENT auth.logout", response); |
|
}); |
|
|
|
FB.Event.subscribe('auth.prompt', function(response) { |
|
// fired when user is prompted to log in or opt in to Platform after clicking a Like button. |
|
// The response parameter to the callback function contains the URL that initiated the prompt |
|
console.log("Facebook EVENT auth.prompt", response); |
|
}); |
|
|
|
FB.Event.subscribe('xfbml.render', function(response) { |
|
// fired when a call to FB.XFBML.parse() completes. The response parameter to the callback function is empty for this event |
|
console.log("Facebook EVENT xfbml.render", response); |
|
}); |
|
|
|
FB.Event.subscribe('edge.create', function(response) { |
|
// fired when the user likes something (fb:like). The response parameter to the callback function contains the URL that was liked |
|
console.log("Facebook EVENT edge.create", response); |
|
}); |
|
|
|
FB.Event.subscribe('edge.remove', function(response) { |
|
// fired when the user unlikes something (fb:like). The response parameter to the callback function contains the URL that was unliked |
|
console.log("Facebook EVENT edge.remove", response); |
|
}); |
|
|
|
FB.Event.subscribe('comment.create', function(response) { |
|
// fired when the user adds a comment (fb:comments). |
|
console.log("Facebook EVENT comment.create", response); |
|
}); |
|
|
|
FB.Event.subscribe('comment.remove', function(response) { |
|
// fired when the user removes a comment (fb:comments) |
|
console.log("Facebook EVENT comment.remove", response); |
|
}); |
|
|
|
FB.Event.subscribe('message.send', function(response) { |
|
// fired when the user sends a message using the send button. |
|
console.log("Facebook EVENT message.send", response); |
|
}); |
|
|