Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
  • Games
  • Payments
  • App Center
  • Promote Your App
  • iOS
  • Android
  • JavaScript
    • Getting Started
    • How-Tos
    • Reference
  • PHP
  • More SDKs
  • Core Methods
    • FB.api
    • FB.init
    • FB.ui
  • Auth Methods
    • FB.getAuthResponse
    • FB.getLoginStatus
    • FB.login
    • FB.logout
  • Event Handling
    • FB.Event.subscribe
    • FB.Event.unsubscribe
  • XFBML
    • FB.XFBML.parse
  • Canvas Methods
    • FB.Canvas.Prefetcher.addStaticResource
    • FB.Canvas.Prefetcher.setCollectionMode
    • FB.Canvas.hideFlashElement
    • FB.Canvas.scrollTo
    • FB.Canvas.setAutoGrow
    • FB.Canvas.setDoneLoading
    • FB.Canvas.setSize
    • FB.Canvas.setUrlHandler
    • FB.Canvas.showFlashElement
    • FB.Canvas.startTimer
    • FB.Canvas.stopTimer

FB.Event.unsubscribe

JavaScript › Reference › FB.Event.unsubscribe

Overview

Removes handlers on events so that it no longer invokes your callback when the event fires.

Example

// Attach the handler using FB.Event.subscribe
FB.Event.subscribe('edge.create', handleResponse);

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

// At some point, you no longer want to be notified, and unsubscribe
FB.Event.unsubscribe('edge.create', handleResponse);

FB.Event.Unsubscribe is the opposite event to FB.Event.subscribe.

Best Practices

You must call FB.Event.subscribe prior to calling FB.Event.unsubscibe.

Parameters

NameTypeDescription
nameString

Name of the event.

cbFunction

The handler function.

Updated about 5 months ago
Facebook © 2013 · English (US)
AboutAdvertisingCareersPlatform PoliciesPrivacy Policy