Facebook Developers
DocumentationSupportBlogAppsLog In
  • Getting Started
  • Core Concepts
  • Advanced Topics
  • SDK Reference
    • JavaScript SDK
    • PHP SDK
    • iOS SDK
    • Android SDK
  • Tools
  • Core Methods
    • FB.api
    • FB.init
    • FB.ui
  • Auth Methods
    • FB.getAuthResponse
    • FB.getLoginStatus
    • FB.getSession
    • FB.login
    • FB.logout
  • Event Handling
    • FB.Event.subscribe
    • FB.Event.unsubscribe
  • XFBML Methods
    • FB.XFBML.parse
  • Canvas Methods
    • FB.Canvas.Prefetcher.addStaticResource
    • FB.Canvas.Prefetcher.setCollectionMode
    • FB.Canvas.getPageInfo
    • 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

SDK Reference › JavaScript SDK › 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(response));

// 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 10 months ago
Facebook © 2012 · English (US)
AboutCareersPlatform PoliciesPrivacy Policy