JavaScript

Cancel Event Subscription

Updated: May 25, 2018
Copy for LLM
The method FB.Event.unsubscribe() allows you to un-subscribe a callback from any events previously subscribed to using FB.Event.subscribe().
FB.Event.unsubscribe(event, callback)

Parameters

Name Type Description
event
enum{}
The name of the event type you want to unsubscribe from. Matches the event types shown in .Event.subscribe().
callback
function
The callback function that you want to unsubscribe from the provided event type. This method call will fail if an existing Event subscription for this callback did not already exist.

Example

Unsubscribing the handleResponse callback from auth.statusChange:
FB.Event.subscribe('auth.statusChange', handleResponse);

var handleResponse = function(response) {
   alert ('You liked the URL: ' + response);
};

FB.Event.unsubscribe('auth.statusChange', handleResponse);